Posted by Erlend Klakegg Bergheim on 03/11/06 12:28
Stefan Mueller skrev:
> I've a web page with several input boxes. After the user clicks 'submit' I
> insert these data into my MySQL database.
> This worked for several months perfect. But today a user entered the street
> name
> Route d'Yverdon 59
>
> unfortunately the data has not been inserted into my MySQL database because
> of the apostroph (') in the name of the street.
>
> I've no idea how to deal with this problem.
> Is there any possibility to avoid that my PHP & Java scripts don't interpret
> apostrophs (') and semicolons (")?
$road = "Route d'Yverdon 59";
$readyForDatabase = mysql_real_escape_string($road);
You can also use addslashes().
http://php.net/mysql-real-escape-string
http://php.net/addslashes
--
Vennlig hilsen
Erlend Klakegg Bergheim
Navigation:
[Reply to this message]
|