View Single Post
  #2 (permalink)  
Old 08-27-2007, 09:12 AM
DaveSawers's Avatar
DaveSawers DaveSawers is offline
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 384
DaveSawers RepRank 1
Default Re: single quote in mysql record

You have to escape the single quote, so if you're using PHP, something like:

$query = "insert ... var='Tom\'s', ..."

or using your example directly, you could alternatively use:

$variable = "Tom's";
addslashes($variable);

to do the same thing. addslashes is an internal PHP function: PHP: addslashes - Manual
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote