Re: Problem with apostrophes!!
| From: | Reuben D Budiardja | Date: | Tue, 13 Mar 2001 03:32:21 +0000 |
| Subject: | Re: Problem with apostrophes!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43606@lists.php.net to get a copy of this message | ||
Maybe you can use this function. I don't use MySQL, I use Oracle, and I build this function for Oracle, but I think the basic problem (and solution is the same). I think basically you need to escape ' by adding another '. Thus "Ken's" should become "Ken''s".
function format_mysql_string($string)
{
$string = StripSlashes($string);
$string = ereg_replace("'", "''", $string);
return $string;
}
Reuben D. Budiardja
At 09:19 PM 3/12/01 -0600, Kenneth R Zink II wrote:
My MySQL insert statements is returning errors when a field has an apostrophe in it. (I.E. Ken's) is there a way to get around that without using the \ in front of the apostrophes?? I've never had this problem before, in the past (on different servers) when a variable is inserted, it just accepted it. Help!! I need to know A.S.A.P.Kenneth R Zink II Hellcat1@S-Series.Org ICQ# 5095094'87 GMC S-15 Ext. Cab (Hurricane) ...BBC 524 being built !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI !!! http://www.s-series.org/htm/firestorm/firestorm.htm '84 Oldsmobile Delta 88 Delta 88 Royal Brougham. Racing by the grace of God!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net