jakatu Posted July 24, 2008 Share Posted July 24, 2008 I am trying to get an array of all of the values in a column in a table in my database. can anybody tell me how to do this? Link to comment https://forums.phpfreaks.com/topic/116481-solved-i-want-an-array/ Share on other sites More sharing options...
GingerRobot Posted July 24, 2008 Share Posted July 24, 2008 Cycle through the results and add to the array each time you do: <?php $sql = "SELECT field FROM table"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); $array = array(); while($row = mysql_fetch_assoc($result)){ $array[] = $row['field']; } print_r($array); ?> Link to comment https://forums.phpfreaks.com/topic/116481-solved-i-want-an-array/#findComment-598995 Share on other sites More sharing options...
jakatu Posted July 24, 2008 Author Share Posted July 24, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/116481-solved-i-want-an-array/#findComment-598999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.