Search result
I want to find out what the correct syntax would be to use when querying multiple columns. What I have is:
mysql_select_db($database_LastMinuteConfirm, $LastMinuteConfirm); $province = $_POST['province']; $near_city = $_POST['near_city']; $accomm_type = $_POST['accomm_type']; $norm_price_range = $_POST['norm_price_range']; $query_Recordset1 = "SELECT * FROM lastminuteconfirm WHERE province = %$province% AND near_city = %$near_city% AND accomm_type = %$accomm_type% AND norm_price_range = %$norm_price_range%"; $Recordset1 = mysql_query($query_Recordset1, $LastMinuteConfirm) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1);
When I search it tells me: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%Gauteng% AND near_city LIKE %Pretoria (Tshwane)% AND accomm_type LIKE %boutique' at line 1".
What am I doing wrong?
