Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Quote mark in string messing up mySQL INSERT

by Cmdr_Tofu (Scribe)
on Dec 13, 2002 at 04:10 UTC ( #219494=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Quote mark in string messing up mySQL INSERT
in thread Quote mark in string messing up mySQL INSERT

Is it safe to use apostrophes instead of quotes? In the past I have always done:
$dbh->do("insert into mytable values('$myStringWhichPossiblyContainsQu +otes', '$another string', ...);
Rohit

Replies are listed 'Best First'.
Re^4: Quote mark in string messing up mySQL INSERT
by htoug (Deacon) on Dec 13, 2002 at 08:24 UTC
    Nope!!
    What if your variables contain apostrophes? Or other 'nasty' characters?

    Stick with either $dbh->quote($variable) or use placeholders.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219494]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2021-10-16 21:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (70 votes). Check out past polls.

      Notices?