For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2006 > Single quotes in INSERT statements?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Single quotes in INSERT statements?
Skip Evans

2006-04-25, 6:59 pm

Hello all,

I'm brand spanking new to the list and have a
quick question.

I was under the impression that addslashes() would
handle single quote marks in INSERT statements,
but when I execute the following:

$sql="UPDATE images SET orderno=$orderno,
url='".addslashes($url)."',
banner=$banner,caption='".addslashes($caption)."'
WHERE imageID=$imageID";

....and $caption contains something like:

"Don't look"

....the data is chopped off at the single quote mark.

How, if not addslashes(), does one handle this?

Thanks!
--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com