Skip navigation links

MySQL Forums :: PHP :: MYSQL Query error - not working


Advanced Search

MYSQL Query error - not working
Posted by: Rajesh BG ()
Date: July 22, 2009 05:02AM

Hi All,
Am new to PHP & MySQL. I have a page to display the data from the database with pagination. Am using below SQL query.

SELECT * FROM interactive where published='yes' ORDER BY date desc LIMIT $from, $max_results

When I run the above query am getting an error(MySQL error - #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to us near '$from, $max_results LIMIT 0, 30' at line 1). I checked the syntax its fine.

When the query is simple(SELECT * FROM interactive where published='yes' ORDER BY date desc) there is no issue. With LIMIT $from, $max_results its causing an error. I need this to get the pagination with pg number.

The same code on same DB & other table is working fine. Am not sure how to handle this. Let us if you people have any solution for this.

Options: ReplyQuote


Subject Written By Posted
MYSQL Query error - not working Rajesh BG 07/22/2009 05:02AM
Re: MYSQL Query error - not working Peter Brawley 07/23/2009 08:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.