List:General Discussion« Previous MessageNext Message »
From:Jay J Date:September 16 1999 7:36am
Subject:Re: update and $dbh->quote
View as plain text  
----- Original Message -----
From: Jesse <jesse@stripped>
To: Jay J <3pound@stripped>; <jice@stripped>;
<mysql@stripped>
Sent: Thursday, September 16, 1999 1:39 AM
Subject: Re: update and $dbh->quote


> At 01:14 AM 9/16/99 -0500, Jay J wrote:
>
> >> hi,
> >>   i'm trying to do this with DBD::mysql:
> >>
> >> $quo_mesg = $dbh->quote($message) or &error;
> >> $dbh->do("update email set $column = '$quo_mesg'
> >>           where username = '$recipiant'");
> >>
> >>
> >> and  DBI::errstr is giving me an error i don't
> >> understand.  Is it okay to use quote with and update statment?
> >
> >Which "error I don't understand" would that be?
> >
> >Sure it's okay .. AMOF in that snippit, DBI::quote has nothing to do with
> >the update.
>
> Actually, I think it has a lot to do with it!

I stand corrected, technically speaking..

Given that the original post failed to note what the error was or where it
was blowing up, what I should* have said is: if $dbh->quote() is failing in
line 1 (like undefined $dbh) .. that has nothing to do with line 2.

The problem is the fact that '$quo_mesg' is doubly-single-quoted.. your
solution for inline concating definately works (unless $recipiant is already
quoted also..)

What the original poster might find helpful is to split things up:

    my $sql = q!UPDATE email SET !  . $column . q! = ! .
$dbh->quote($message);
    $sql .= q! WHERE username = ! . $dbh->quote($recipiant);
    my $rc = $dbh->do($sql);

    ... test for $rc, or error .. etc.. etc..

I guess it's too late to hope this thread will evoke a more descriptive
error message from the orginal post..

-Jay J



Thread
Sum/group by/having error in 3.23.3web16 Sep
  • update and $dbh->quotejice16 Sep
    • Re: update and $dbh->quoteJay J16 Sep
      • Re: update and $dbh->quoteJesse16 Sep
        • Re: update and $dbh->quotejice16 Sep
          • Re: update and $dbh->quoteChris16 Sep
            • Re: update and $dbh->quotejice16 Sep
              • Re: update and $dbh->quoteChris16 Sep
                • Re: update and $dbh->quotejice16 Sep
    • Re: update and $dbh->quoteJay J16 Sep
      • Re: update and $dbh->quotejice16 Sep
  • Sum/group by/having error in 3.23.3Michael Widenius18 Sep