icez Posted July 26, 2010 Share Posted July 26, 2010 ** I'm french so, sorry for my bad english *** I have no idea of how to do this so thank you to any one who can give me an hint to how! I want to retrieve all numbers in the column chapter of my database and create an array or a string with it. ///////////////////////////////// //CHAPTER | DATE | ... | // // 28 | XX | ... | // // 29 | XX | ... | // ... The result I want to get from the script should be something like this... $string = '28,29,30,31,32'; Link to comment https://forums.phpfreaks.com/topic/208882-phpmysql-create-an-array-or-string-from-a-column-and-not-a-row/ Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2010 Share Posted July 26, 2010 $query = "SELECT `chapter` FROM `table_name` ORDER BY `chapter` ASC"; $result = mysql_query($query); while($array = mysql_fetch_assoc($result)) { $list[] = $array['chapter']; // to store results in an array } Link to comment https://forums.phpfreaks.com/topic/208882-phpmysql-create-an-array-or-string-from-a-column-and-not-a-row/#findComment-1091107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.