Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am using PHP 4.3.3 with MySQL. Wh

Status
Not open for further replies.

dyedblue

Technical User
Aug 20, 2004
11
0
0
US
I am using PHP 4.3.3 with MySQL. Whenever I use the following Query,

$sql_search = "SELECT * FROM $table WHERE case = '$searchFor'";

I get the following error seen below this post. I can query on any column not named "case" in any other tables. Is "case" forbidden in SQL syntax? Or does anyone have any info they think could help me out? Thanks in advance for your help.

"Error in executing query: 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 '= 'case'' at line 1"

 
Of course, "case" is a reserved word in mysql.

You either need to surround it with backticks ´´ , Or rename your column.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top