Forum Moderators: coopster
$connection = new mysqli($server, $dbusername, $dbpassword, $databasename)
or die(mysql_error());
if ($connection->connect_error) {
die("ERROR: Unable to connect: " . $connection->connect_error);
}
$searchStmt = "SELECT * FROM fhs_properties WHERE " ;
if ($search_mots)
{
$searchStmt .= ("desc_fr LIKE '%$search_mots%'");
}
if ($search_mots) $searchStmt .= " ";
//mots 1blank
if (!$search_mots) $searchStmt .=" ";
$or='';
if (!$search_mots)
{
$searchStmt .= ("desc_fr = ' '");
}
if (!$search_mots) $searchStmt .= "OR";
//new
if ($search_new) $searchStmt .=" ";
$or='';
if ($search_new)
{
$searchStmt .= ("new = '$search_new'");
}
if ($search_new) $searchStmt .= " ";
if (!$searchtenant) $searchStmt .= " Order By price ASC ";
$stmt= substr($searchStmt, 0, strlen($searchStmt)-0) ;
echo $searchStmt;
// Connect to the Database
if (!($link=new mysqli($server, $dbusername, $dbpassword))) {
exit() ;
}
// Select the Database
if (!mysqli_select_db($databasename, $link)) {
exit() ;
}
// Execute the Statement
if (!($result = $connection->query($stmt, $link))) {
exit() ;
}
// Display the results of the search
if ($rows = mysqli_num_rows($result))
{
$number = mysqli_num_rows($result);
echo "number of results is $number";
} [edited by: RobertMallett at 1:38 pm (utc) on Aug 5, 2020]