note 97716 modified in function.addslashes by danbrown
| From: | danbrown@php.net | Date: | Tue, 04 May 2010 20:47:40 +0000 |
| Subject: | note 97716 modified in function.addslashes by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168939@lists.php.net to get a copy of this message | ||
Heres a hassle free function to use to check your query string and before its handed to the db. It
will add/remove slashes according to the get_magic_quotes_gpc state
<?php
function mysql_prep($value)
{
if(get_magic_quotes_gpc()){
$value = stripslashes($value);
} else {
$value = addslashes($value);
}
return $value;
}
?>
--was--
Heres a hassle free function to use to check your query string and before its handed to the db. It
will add/remove slashes according to the get_magic_quotes_gpc state
function mysql_prep($value)
{
if(get_magic_quotes_gpc()){
$value = stripslashes($value);
} else {
$value = addslashes($value);
}
return $value;
}
http://php.net/manual/en/function.addslashes.php