Page 1 of 1

PHP MySQL Query

Posted: Fri Jan 04, 2008 12:02 pm
by kumarrana
I have been getting error for the following code.

Code: Select all

$read_post = "SELECT * FROM `post` LIMIT $offset, $rowPerPage ORDER BY 'date_created' DESC";
As soon as I added "ORDER BY" I got error.
Can anybody help me on debugging.

Posted: Fri Jan 04, 2008 12:48 pm
by arjan.top
put LIMIT after ORDER BY

PHP/MySQL

Posted: Fri Jan 04, 2008 1:01 pm
by kumarrana
Thanks a lot. It worked fine.

Posted: Fri Jan 04, 2008 1:43 pm
by Zoxive
For future "Debugging" Echo out the error mysql is giving you, it usually is straight forward.
If not, a simple google search of the error will find you a quick answer.