jbeninger has asked for the wisdom of the Perl Monks concerning the following question:
This error has me completely stumped, so I'm hoping that one of you has run into the problem and may be able to help me. I'm getting an error (You have an error in your SQL syntax near '' at line 1) whenever I run a specific query in my script.
The Basics:
mysql -V: mysql Ver 11.18 Distrib 3.23.54, for redhat-linux-gnu (i386)
perl -v: v5.8.0
Table I'm having trouble with:
CREATE TABLE categories (id BIGINT, parent BIGINT, name VARCHAR(40), full_name VARCHAR(255))
Query I'm having trouble with:
SELECT parent FROM categories WHERE id=1
The categories table is a group of nested categories. Categories have an id, the id of a parent category, a name (eg "Birds"), and a full name (eg "Animals->Birds"). The query works in the mysql shell, but fails with the above error code when run as a cgi script. Every other database query has worked fine.
Even more puzzling, if I change the query to "SELECT id...", "SELECT full_name...", etc, it works fine. I thought maybe "parent" was an undocumented reserved word, so I changed the column name to "parent_id". Still no dice. This is frustrating me to no end - if anyone can give me an answer, I'd love to hear it.
Thanks in advance
James Beninger
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Unexplained MySQL Error
by blokhead (Monsignor) on Jul 20, 2003 at 03:22 UTC | |
Re: Unexplained MySQL Error
by rnahi (Curate) on Jul 20, 2003 at 08:31 UTC | |
Re: Unexplained MySQL Error
by bobn (Chaplain) on Jul 20, 2003 at 02:34 UTC | |
Re: Unexplained MySQL Error
by antirice (Priest) on Jul 20, 2003 at 02:33 UTC | |
Re: Unexplained MySQL Error
by graff (Chancellor) on Jul 20, 2003 at 02:41 UTC | |
Re: Unexplained MySQL Error
by jbeninger (Monk) on Jul 20, 2003 at 15:19 UTC | |
by dbwiz (Curate) on Jul 20, 2003 at 18:46 UTC | |
by jbeninger (Monk) on Jul 21, 2003 at 02:07 UTC | |
by jbeninger (Monk) on Jul 21, 2003 at 13:54 UTC | |
by Anonymous Monk on Jul 21, 2003 at 14:06 UTC | |
| |