|Perl Monk, Perl Meditation|
Unexplained MySQL Errorby jbeninger (Monk)
|on Jul 20, 2003 at 01:48 UTC||Need Help??|
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.
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:
Query I'm having trouble with:
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