captainspi Posted July 17, 2008 Share Posted July 17, 2008 Hi there, Is it possible to extract data from a particular mysql column and store it in an array? Thanks in advance... Link to comment https://forums.phpfreaks.com/topic/115212-solved-transferring-data-from-a-mysql-column-to-a-php-array/ Share on other sites More sharing options...
GingerRobot Posted July 17, 2008 Share Posted July 17, 2008 You'll want something like this: $sql = "SELECT field FROM yourtable"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); $array = array(); while($row = mysql_fetch_row($result)){ $array[] = $row[0]; } print_r($array); Link to comment https://forums.phpfreaks.com/topic/115212-solved-transferring-data-from-a-mysql-column-to-a-php-array/#findComment-592380 Share on other sites More sharing options...
captainspi Posted July 17, 2008 Author Share Posted July 17, 2008 thanks a lot! Link to comment https://forums.phpfreaks.com/topic/115212-solved-transferring-data-from-a-mysql-column-to-a-php-array/#findComment-592445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.