I'm puzzled how this changes things. At
http://dev.mysql.com/doc/refman/5.1/en/select.html it says:-

"... LIMIT row_count is equivalent to LIMIT 0, row_count. ..."

So "select * from newsa ORDER BY id DESC LIMIT 0,3" is functionally
identical to "select * from newsa ORDER BY id DESC LIMIT 3". Indeed for
me it returns exactly the same result and in the same order. I feel that
the original problem arises not from the select statement but the PHP
that displays the rows. Or am I missing soemthing here?

Charlie
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of HardyBoyz
Sent: 05 May 2008 09:24
To: [email protected]
Subject: RE: [php_mysql] DESC in mysql results

The query is 

select * from newsa ORDER BY id DESC LIMIT 0,3

look at the query above carefully.


 From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tedit kap
 Sent: 04 May 2008 01:42
 To: [email protected]
 Subject: [php_mysql] DESC in mysql results
 
 Hi all,
  
  
 $query=mysql_query("select * from newsa ORDER BY id DESC LIMIT 3");
  
 while ($row = mysql_fetch_array($query)) { echo"..............
  
 if we say the id of rows goes from 1 to 100, so the last row's id is
100,
  
 this code displays the results for the ids as follows:
  
 row with id 98
 row with id 99
 row with id 100
  
 The question is, I want it to display as :
  
 row with id 100
 row with id 99
 row with id 98
  
 How can I achieve this?
  
 (if i try ASC instead of DESC it displays rows with ids 1,2,3 - that is
not what I want)

Reply via email to