Forum Moderators: coopster

Message Too Old, No Replies

common email characters not accepted by mysql

         

brendan3eb

5:14 pm on Jan 30, 2005 (gmt 0)

10+ Year Member



I'm making array of characters to replace with temporary proxys (equalsign, singlequote, doublequote, etc.) that will be switched back the original character when a user views his or her emails. For those of you who've done e-mail scripts with mysql before, which characters have proven to be the most trouble (I'm only imagining how many emails one email could hold up if checkmail.php's error array didn't have a certain charactter)?

mcibor

9:59 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As usual: single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).

However there's a function mysql_escape_string() or addslashes() which escapes the above chars automatically.

The only other sign that could be problemous is %, however if you write correctly the query, there won't be any problems!

Best regards
Michal Cibor

ergophobe

12:25 am on Jan 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You may want to check for whether or not magic_quotes_gpc is on before using addslashes as in

if (!get_magic_quotes_gpc())
{
$email = mysql_real_escape_string($email);
}

As Michal said, you still have to watch for % and _