Jump to content

[SOLVED] php/mysql order by with while loop...I must be missing something


DamienRoche

Recommended Posts

I have a very simple mysql query which fetches some results using a while loop:

 

<?php

$data=mysql_query("SELECT * from cats ORDER BY 'ord' ASC");

while($fetch=mysql_fetch_array($data)){ 
$maincat = $fetch['maincat'];
$mainkey = $fetch['mainkey'];
$order = $fetch['ord'];

echo "$maincat, $mainkey, $order<br>";

}

?>

 

...thing is, I just can't seem to order this ouput by anything. Is it the while statement?

 

Thanks.

 

 

lmao...seriously, I should give this up. Damn syntax error. I jsut figured that's how it had to be, since when I refer to the cols, I use '' in the fetch.

 

Never mind, thanks!

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.