dusoo Posted March 14, 2009 Share Posted March 14, 2009 Hi guys, could you please help me to populate one array with data from oracle table column? And later i would like to match one string with that array //query: $mquery= "select column from TMP_TAB where keycol=asdf"; //parse query $conn->query($mquery,true); $rows = $conn->row_cnt(); echo "$rows"; //Works for me until here. //I have tried to use following lines from one script, but could not get it working to populate my array... //Maybe it is even not needed for my case. for($lj=0; $lj < $rows; $lj++) { //$my_array[???] = $conn->data($lj,0); } //here i would like to match one string with that array - in_array is good for that? //Because i dont want to go through that array again in loop if possible. if (in_array($my_string,$my_array)) { echo "more code will come here"; } Thanks guys, sorry for my simple knowledge of PHP. ... Link to comment https://forums.phpfreaks.com/topic/149356-solved-populate-array-help/ Share on other sites More sharing options...
dusoo Posted March 14, 2009 Author Share Posted March 14, 2009 Anyone could help? Link to comment https://forums.phpfreaks.com/topic/149356-solved-populate-array-help/#findComment-784799 Share on other sites More sharing options...
zq29 Posted March 14, 2009 Share Posted March 14, 2009 Does this get you any further? <?php $my_array = array(); $my_string = "foo"; $mquery= "select column from TMP_TAB where keycol=asdf"; $conn->query($mquery,true); $rows = $conn->row_cnt(); for($lj=0; $lj < $rows; $lj++) { $my_array[] = $conn->data($lj,0); } if (in_array($my_string,$my_array)) { echo "more code will come here"; } ?> Link to comment https://forums.phpfreaks.com/topic/149356-solved-populate-array-help/#findComment-784800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.