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? Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
sd9sd Posted July 21, 2008 Author Share Posted July 21, 2008 sorry...won't happen again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.