Page 1 of 1

resolving a problem with the caracter -> ' <- ????

Posted: Mon Sep 20, 2004 10:18 am
by duk
hy

i need to alow the forms to POST data with the caracter -> ' <- it works fine in some cases like POST data in to the database he put it...

but when i use a variable with that caracter and try to update the database will not work fine, maybe becouse of

Code: Select all

<?php

$sql = "select name from table where name='$x' ";


?>
if the variable x is -> I'Myname <- this will afect the query to the database, becouse the variable $x have the caracter ' ...

how do hy, resolve this problem ??

tanks[/b]

Posted: Mon Sep 20, 2004 10:36 am
by MarK (CZ)
Use this function: [php_man]mysql_real_escape_string[/php_man]