Gulsaes Posted November 19, 2008 Share Posted November 19, 2008 I currently have $SADC_ARRAY=array('STATION1','STATION3','STATION2'); when printing it out i get Array ( [0] => FAJS [1] => FAJB [2] => FALA [3] => FAWB) since my list is growing i have moved this array to mysql database But i dont have a clue how to get all the results of the Mysql query stored into $SADC_ARRAY similar to what returns with the above code. $query = "SELECT icao_code FROM stations ORDER BY region DESC"; $result = mysql_query($query); for ($i = 0; $row = mysql_fetch_row($result); $i++) { $result_array[$i] = $row; } return $result_array; But I dont seem to get the same result when i print the array it returns Array ( [0] => Array ( [0] => STATION1 ) [1] => Array ( [0] => STATION2 ) [2] => Array ( [0] => STATION3 ) [3] => Array ( [0] => STATION4) [4] => etc Any help would be greatly appreciated thanks in advance. Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 19, 2008 Share Posted November 19, 2008 I think you want it this way $query = "SELECT icao_code FROM stations ORDER BY region DESC"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $result_array[] = $row['icao_code']; } return $result_array; Quote Link to comment Share on other sites More sharing options...
Gulsaes Posted November 19, 2008 Author Share Posted November 19, 2008 awesome that works, I always get confused with for and while Thanks A million!!! (anyone invented a Big Red Button for coding? they would make a killing) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.