need help!

A

Anonymous

Guest
Ok have been trying to see what is wrong with this all day and cant find out what! Probably something simple!

Code:
$query2 = "SELECT * FROM tables WHERE catid=$cat";

When running this query i get the error:

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 'tables WHERE catid=1' at line 1

I really cant see what is wrong with this query as i have other queries running on the same server in the same format that work fine.

Any ideas anyone?
 
Is your table name actually "tables" ?

I'm pretty sure tables is a reserved work and it won't actually allow you to make a table named "tables". Perhaps you have to replace the actual table name with the word "tables" in your query statement. If you do that, it should work fine.
 
yes tables,databases.. reserved words
if tables is not your actual table, then it is better to post your actual query.
if you are running phpmyadmin then it is better to make/test your queries there and then copy paste edit it to your needs...
 
yea that was the problem! Changed it now and all works!

Thanks soooooooooo much :D

(that was really starting to annoy me!)
 
Back
Top