Need some mysql query help.

Syran

Golden Member
Dec 4, 2000
1,493
0
76
I have a script, which i've used successfully in the past, that is giving me an error this time out. It allows you to search multiple categories for what you are looking for. In the case of this code, it works for 4 of the 5 seaches. Here's is the basic db design:

id int(11)
at int(11)
vendor varchar(60)
actpn varchar(10)
part varchar(30)
desc varchar(200)

Here is the error message i'm getting:
You have an error in your SQL syntax near 'desc LIKE '%blah%' ORDER BY id' at line 3
Couldn't execute query: SELECT * FROM atminv_item WHERE desc LIKE '%blah%' ORDER BY id

And finally, the entire code script:
 

Syran

Golden Member
Dec 4, 2000
1,493
0
76
I have 5 items you can search: at, actpn, part, vendor, and desc. All have tested and worked EXCEPT for desc. I'm not sure why, since I have other varchar items in it, and i've never had any issues with this search code before now.
 

lozina

Lifer
Sep 10, 2001
11,711
8
81
I would try renaming the column to something other than "desc"- which is a keyword in most databases....

 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: lozina
I would try renaming the column to something other than "desc"- which is a keyword in most databases....

:thumbsup:

This would be my suggestion as well.
 

Syran

Golden Member
Dec 4, 2000
1,493
0
76
Thanks for the quick reply :) It worked! I thought it would be something simple.