Greetings Monks,
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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.