Re: Not working in MYSQL5.1
Posted by:
Rick James
Date: August 19, 2010 08:15PM
Turn the code around (after backticking range), from
$getrange = $_GET['rangesel'];
$getwood = $_GET['woodsel'];
$getroom = $_GET['roomsel'];
if ($getrange == 'All') {
$getrange = '%';
}
if ($getwood == 'All') {
$getwood = '%';
}
if ($getroom == 'All') {
$getroom = '%';
}
to something like
$getrange = $_GET['rangesel'];
$getwood = $_GET['woodsel'];
$getroom = $_GET['roomsel'];
$wheres = array();
if ($getrange != 'All') {
$e = mysql_real_escape_string($getrange);
$wheres[] = "`range` LIKE '$e'";
}
if ($getwood != 'All') {
$e = mysql_real_escape_string($getwood );
$wheres[] = "wood LIKE '$e'";
}
if ($getroom != 'All') {
$e = mysql_real_escape_string($getroom );
$wheres[] = "room LIKE '$e'";
}
$where = implode(' AND ', $wheres)
* The query will run a lot faster whenever the user says All.
* You are protected from quotes, etc being in the input.
Subject
Written By
Posted
Re: Not working in MYSQL5.1
August 19, 2010 08:15PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.