List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 10 2002 4:09pm
Subject:Re: Qoute
View as plain text  
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?
>>
>>  Jay
>
>Sure.
>
>$sth = $dbh -> prepare ("SELECT expiration from newsgroups WHERE
>newsgroup='$group'");
>$sth -> execute;


$sth = $dbh->prepare ("SELECT expiration FROM newsgroups WHERE newsgroup = ?");
$sth->execute ($group);

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
the statement.

>
>$group, btw, where it goes wrong, is a recovery newsgroup called
>"alt.support.abuse-partners".
>
>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.
>
>- Mark
>

Thread
TransactionsChristophe Demange10 May
  • QouteMark10 May
    • RE: QouteJay Blanchard10 May
      • Re: QouteMark10 May
        • RE: QouteJay Blanchard10 May
          • Re: QouteMark10 May
        • Re: QoutePhilip Molter10 May
        • Re: QoutePaul DuBois10 May
        • Re: QouteMichael Stassen10 May
      • Re: QouteMark10 May
    • Re: QoutePaul DuBois10 May
Re: QouteMark10 May