mysql_escape_string()
Moderator: General Moderators
- php3ch0
- Forum Contributor
- Posts: 212
- Joined: Sun Nov 13, 2005 7:35 am
- Location: Folkestone, Kent, UK
mysql_escape_string()
HI Everyone how do I un escape string the data ?
on a side note - if all has gone well with the escaping, then the use of stripslashes() should notbe necessary. (if you are having to escape after extraction from DB that is.) Have you checked if magic_quotes_gpc is on before escaping?
Code: Select all
<?php
function SqlClean ($string)
{
if (get_magic_quotes_gpc()) {
$string = stripslashes($string);
}
return mysql_real_escape_string($string);
}
$query = "SELECT `column` FROM `table` WHERE `column` = '" . SqlClean($value) . "'");
?>- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland