You can also try replacing quote marks with their HTML-equivalent entities.
Put this function in your code somewhere:
function PrepareQuotes($Var)
{
$Var = str_replace("'","'",$Var);
$Var = str_replace('"',""",$Var);
return $Var;
}
And on variables that might have apostrophes or quote marks, do this:
$VarWithApostrophe = PrepareQuotes($VarWithApostrophe);
So something like Joe's Farm will look like Joe's Farm. It gets
inserted into the database without any addslashes, and when you retrieve it
from the database, it should work fine without any converting to this or
that.
- Jonathan
-----Original Message-----
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 08, 2002 7:11 PM
To: [EMAIL PROTECTED]
Subject: apostrophe's in PHP & MySQL
Hi,
I've been experiencing some sporadic problems with a few web forms written
in PHP 3.0.16 and MySQL 3.23.31 with text fields (both single lines and
rows). Generally if any of the text in these forms contains an apostrophe
- either nothing is entered into the database, or nothing after the
apostrophe is entered.
Is there a way around this? Or is this a limitation of my older versions
of PHP and MySQL?
Thanks
-Tim
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php