At 17:49 +0200 5/10/02, Mark wrote:
> > This is too weird; I can quote until I see blew in the face, but I cannot
>> seem to make MySQL understand that the name 'group-name' is valid to
>> select. It keeps blabbing "You have an error in your SQL syntax". I mean,
>> what is the purpose of its own quote function if it can not even quote
>> properly? Every other name works fine, except when a WHERE clause looks
>> for a column whose value has a dash in it. [/snip]
>> Can we see the query?
>$sth = $dbh -> prepare ("SELECT expiration from newsgroups WHERE
>$sth -> execute;
$sth = $dbh->prepare ("SELECT expiration FROM newsgroups WHERE newsgroup = ?");
Note: no quotes around the placeholder character.
>$group is a newsgroup name; all queries go fine, except one that has a dash
>in it. I have tried quoting $group, like:
>$newsgroup = $dbh -> quote ($group);
That will work, unless you left the quotes around the variable in
>$group, btw, where it goes wrong, is a recovery newsgroup called
>I have had Perl quotemeta the whole thing, I haver dropped and added the
>single-quotes, I have used place-holders, etc. But I always get, "You have
>an error in your SQL syntax".
>Funnily enough, I had no problem inserting the name into the column.
>Sigh. This is such a newbie question, I realize it. But it is rather
>frustrating. I appreciate your help.