sd9sd Posted July 2, 2008 Share Posted July 2, 2008 I have a table like this: --------------------------------------- order | rating | name --------------------------------------- 0 | 543 | abc 2 | 34 | dfwe 8 | 45 | ssf --------------------------------------- I need to get the contents of the 'order' column into an array like so: echo $orderNumbers[0]; //traces 0 echo $orderNumbers[1]; //traces 2 echo $orderNumbers[2]; //traces 8 This is the php code I'm using unsuccessfully: $query = mysql_query("SELECT * FROM `data`"); while($row = mysql_fetch_array($query)){$result=$row['order'];} $result=explode(",",$result); echo "length of array=".count($result)."<br>"; for($i=0;$i<count($result);$i++) {echo "$result[$i] <br>";} Could anyone show me the right query to get the data please? Link to comment https://forums.phpfreaks.com/topic/112897-solved-trouble-getting-info-from-a-column/ Share on other sites More sharing options...
sd9sd Posted July 2, 2008 Author Share Posted July 2, 2008 Apologies...topic got solved faster here http://www.phpfreaks.com/forums/index.php/topic,204794.html Link to comment https://forums.phpfreaks.com/topic/112897-solved-trouble-getting-info-from-a-column/#findComment-579895 Share on other sites More sharing options...
fenway Posted July 2, 2008 Share Posted July 2, 2008 So you double-posted... that's a no-no. Link to comment https://forums.phpfreaks.com/topic/112897-solved-trouble-getting-info-from-a-column/#findComment-579928 Share on other sites More sharing options...
sd9sd Posted July 21, 2008 Author Share Posted July 21, 2008 sorry...won't happen again. Link to comment https://forums.phpfreaks.com/topic/112897-solved-trouble-getting-info-from-a-column/#findComment-595220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.