Thanks for letting us know would like a pound for each time I've done things like that !!!
Charlie -----Original Message----- From: php_mysql@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tedit kap Sent: 09 May 2008 20:08 To: php_mysql@yahoogroups.com Subject: Re: [php_mysql] DESC in mysql results you're right actually...here was the mistake: I looked at the actual data in the table..and the problem was I had entered the data to the table in reverse dated order... so when mysql displayed correctly, i thought it displayed in wrong order...so yes it works, sorry for confusion.. just a beginner and my first database here...at least we confirmed that we know what we are talking about huh? :P ----- Original Message ---- From: HardyBoyz <[EMAIL PROTECTED]> To: php_mysql@yahoogroups.com Sent: Tuesday, May 6, 2008 11:36:36 PM Subject: Re: [php_mysql] DESC in mysql results When i try that sql sintaks in phpmyadmin, it's works. i have 5 records, n i want to show 3 last records. n the result is row with id 5 row with id 4 row with id 3 So, who false?, phpmyadmin or your code. have you set primary key?, but i think it's not the problem. hahah, blank until here. :(. Tedit kap <[EMAIL PROTECTED] com> wrote: I would have to agree with Charlie. When I tried LIMIT 0,3 it did not change anything. I am still looking for a solution. Here is the complete php statement including mysql query, and my question again.... The problem is, it displays as: 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? Here is the code: $query=mysql_ query("select * from newsa ORDER BY id DESC LIMIT 3"); while ($row = mysql_fetch_ array($query) ) { echo"<p class='newstitle1' >" . $row['date'] ."<br/>". $row['title' ] .$row['id']. "</p>". "<p id=newstext1> " . $row['par1'] ; $b=$row['id' ]; echo"<a href='xxxxxxx. php?id=$b' ".">"."(more. ..)"."</a> " ; } ----- Original Message ---- From: Charlie Markwick <[EMAIL PROTECTED] com> To: [EMAIL PROTECTED] ps.com Sent: Tuesday, May 6, 2008 1:00:23 AM Subject: RE: [php_mysql] DESC in mysql results 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] ps.com [mailto:php_ [EMAIL PROTECTED] ps.com] On Behalf Of HardyBoyz Sent: 05 May 2008 09:24 To: [EMAIL PROTECTED] ps.com 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] ps.com [mailto:php_ [EMAIL PROTECTED] ps.com] On Behalf Of Tedit kap Sent: 04 May 2008 01:42 To: [EMAIL PROTECTED] ps.com 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) ____________ _________ _________ _________ _________ _________ _ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile. yahoo.com/ ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ [Non-text portions of this message have been removed] ------------ --------- --------- --- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. [Non-text portions of this message have been removed] ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ [Non-text portions of this message have been removed] ------------------------------------ The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links