Forum Moderators: coopster
I'm using my query like this:
if(isset($_GET['query']))
{
$string = trim($_GET['query']);
}
else
{
$string = '';
}
$search_string = quote_smart($string);
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
//Quote if not integer
if (!is_numeric($value)) {
$value = mysql_real_escape_string($value);
}
return $value;
}
This works fine most of the time, but if I add a space to the end of the query such as "olive oil " it doesn't get trimmed and goes out to the browser as "olive+oil+" which crashes the browser. I've tried replacing the + and chopping it as well as seeing if it's being converted to '%2B', but to no avail. Does anyone know why the query isn't being trimmed?
Thanks
Hope this helps you somehow
Best regards
Michal Cibor