Jump to content

[SOLVED] Trouble getting info from a column


sd9sd

Recommended Posts

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?

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.