willpower Posted March 2, 2007 Share Posted March 2, 2007 Databas with 3 fields id, name ,active rows are 1----option1----1 2----option2----1 3----option3----1 How can i extract all options into a single array so as $results=array('option1','option2','option3'); Link to comment https://forums.phpfreaks.com/topic/40794-return-results-as-array/ Share on other sites More sharing options...
genericnumber1 Posted March 2, 2007 Share Posted March 2, 2007 $query = 'SELECT * FROM table'; $results = mysql_query($query); $array = array(); while($row = mysql_fetch_assoc($results)) { $array[] = $row['colname']; } Link to comment https://forums.phpfreaks.com/topic/40794-return-results-as-array/#findComment-197523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.