Jump to content

[SOLVED] mysql_fetch_array with array_reverse


Fsoft

Recommended Posts

Hello,

$query2 = mysql_query("SELECT * FROM articles where art_cat = $cat");
		while($art_infos = mysql_fetch_array($query2))
		{

echo $art_infos["art_title"];

		}

 

Using this code above, I am able to echo out all the existing art titles available in my database, the only problem is, their order is from new older to new. I mean the title on top is older and the title on the last is the newer. I want them in reverse order,

 

so from NEW to OLD which makes a sense. I tried to use array_reverse. But it doesn't seem to work.

 

Please help me, how can I echo them out in reverse order?

 

Thanks a lot.

 

FAISAL!!!!!!!

 

Thanks friends, but sadly non of them worked :(...

 

The 1st one "WolfRage" gives an error... And mattal999 was suppose to work but actually no :( it gives up same result as if I do it without changing my query :(

 

Any other help???

 

Thanks...

As mattal999 mentioned, you'll want to order it in your query. 

 

You are saying you want "newer" ones first.  Which column in your table signifies older vs. newer? Is there a date column? Id column? You will want to

 

... ORDER BY column DESC

 

 

 

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.