PHP MySQL Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kumarrana
Forum Commoner
Posts: 26
Joined: Sat Sep 01, 2007 12:55 pm

PHP MySQL Query

Post 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.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Post by arjan.top »

put LIMIT after ORDER BY
kumarrana
Forum Commoner
Posts: 26
Joined: Sat Sep 01, 2007 12:55 pm

PHP/MySQL

Post by kumarrana »

Thanks a lot. It worked fine.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post 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.
Post Reply