makphp
10-09-2004, 08:19 AM
Ok. Say i had a table and in the table were 3 rows with the attributes "ID" and "Content".
the 1st row has an ID of "1", and the Content is "Hello"
the 2nd row has an ID of "2", and the Content is "The"
the 3rd row has an ID of "3", and the Content is "World!"
how can i use PHP to order them like this:
3.world
2.the
1.hello
instead of this:
1.hello
2.the
3.world
mwaseem
10-09-2004, 08:28 AM
How do i do this with mysql?
how can i use PHP to order them like this:
3.world
2.the
1.hello
instead of this:
1.hello
2.the
3.world
In MySQL:
SELECT ID, Content FROM tabl_name ORDER BY ID DESC;
In PHP:
Wait for a PHP guru to arrive here.
orbitz
10-09-2004, 08:29 AM
use: "SELECT * FROM your_table ORDER BY ID DESC"
orbitz
10-09-2004, 08:31 AM
Originally posted by mwaseem
In MySQL:
SELECT ID, Content FROM tabl_name ORDER BY ID DESC;
In PHP:
Wait for a PHP guru to arrive here.
the same thing
makphp
10-09-2004, 08:34 AM
Originally posted by orbitz
the same thing
Well i tried it and it works now. thanks!;)
xxtyderxx
10-10-2004, 07:46 PM
I would have never thought of that, I thought you had to go SELECT * FROM table ORDER BY ID DESC LIMIT 10 or something :-P
ANMMark
10-10-2004, 08:44 PM
LIMIT is to limit how many results are shown.
For example..... LIMIT 10 will show only 10 results, etc.
So if you had 26 records....it would show the first 10 in Ascending or Descending order.