the SQL way to escape ' is to use ''.
The preferred DBI way to escape things is to always use placeholders.
See perldoc DBI... or checkout DBIx::AbstractLite as an easier DBI alternative ala 
$DB->query('SELECT * FROM foo WHERE bar = ?', $bar);

ilia.

On Fri, May 18, 2001 at 05:41:18AM -0700, E B wrote:
> Hi
> 
> I have a problem which I am sure there is an easy
> solution to but I just can't find it.
> 
> I use DBI and when I write to MySQL a string
> containing ' (for example the word can't) I get this
> error.
> 
> [6631]ERR: 32: Line 157: Warning in Perl code:
> DBD::mysql::st execute failed: You have an error in
> your SQL syntax near 't' WHERE id='5'' at line 1 at
> skrifagrunn.epl line 160.
> 
> I need to escape ' but no matter how I try it does not
> work.
> 
> John Gustavson
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to