$whereClauses = array();
if (! empty($_POST['house'])) $whereClauses[] ="type='".mysqli_real_escape_string($conn,$_POST['house'])."'";
if (! empty($_POST['price'])) $whereClauses[] ="rate ".mysqli_real_escape_string($conn,$_POST['price'])."";
if (! empty($_POST['any'])) $whereClauses[] ="title or area or postcode LIKE '%".mysqli_real_escape_string($conn,$_POST['any'])."%'";
$where = '';
if (count($whereClauses) > 0) { $where = ' WHERE '.implode(' AND ',$whereClauses); }
I can't seem to get the like statement to work e.g. it wont display any results that match the title column if there is one for the area column, i want all the matches to show. Also whenever i use the 3rd if statement it ignores the first two such as i only want houses that cost over £1000 it will display the ones below that when i use the like.
sql where: WHERE type='House' AND rate > 150 AND title OR area or postcode LIKE '%s%'