PDA

View Full Version : How to resolve "You have an error in your SQL syntax; check the manual..."?


chaucheefui
04-18-2007, 12:21 PM
I am new to all of this stuff and Please help me to resolve this.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'out) as tout from hl_traffic where listing_id = 1 and date + interval 7 day > no' at line 1

First of all, I don't know what that mean.

My host provide :PHP version 4.4.6, MySQL version 5.0.27-standard

Here is the table I created.

id bigint(20) UNSIGNED No auto_increment
date date Yes NULL
listing_id bigint(20) UNSIGNED No 0
in bigint(20) UNSIGNED No 0
out bigint(20) UNSIGNED No 0

If you need more info about the problem, I will provide it for you.

If you know the problem, can you teach me step by step?

Thank You in advance.

CFMaBiSmAd
04-18-2007, 12:31 PM
out is a reserved mysql keyword. You should rename this to something else.

It is possible to use out in a query by placing it in back-ticks `out`, howerver this is non-standard sql and if mysql should more closely follow standards in a future vesion or you should ever move your code to a different type of database, your code will stop working.

guelphdad
04-18-2007, 08:39 PM
also when asking for help it is also helpful to show the actual query you are trying to run, though your table layout above helped spot the problem.

just something to remember for your next post.