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 '= 'sprzedaż'' at line 1
Ciężko mi się połapać o co mu chodzi i gdzie jest błąd. Próbowałem zamiast = użyć LIKE ale też nic z tego.
Wie ktoś o co w tym biega?
Kod
$wh_mi = array();
if (!empty($_POST['typ']))
$wh_mi[] = "typ_oferty = '$_POST[typ]' ";
if (!empty($_POST['miej']))
$wh_mi[] = "miejscowosc = '$_POST[miej]' ";
if (!empty($_POST['powod']))
$wh_mi[] = "metraz >= '$_POST[powod]' ";
if (!empty($_POST['powdo']))
$wh_mi[] = "metraz <= '$_POST[powdo]' ";
if (!empty($_POST['cenaod']))
$wh_mi[] = "cena >= '$_POST[cenaod]' ";
if (!empty($_POST['cenado']))
$wh_mi[] = "cena <= '$_POST[cenado]' ";
if (!empty($wh_mi))
$where_mi = 'WHERE '.implode(' AND ', $wh_mi);
else
$where_mi = '';
$query_mi = "SELECT m_id, typ_oferty, foto1, nr, miejscowosc, dzielnica, ulica, metraz, cena, surowiec, pietro, ilosc_pokoi, waluta FROM mieszkania".$where_mi;
if (!empty($_POST['typ']))
$wh_mi[] = "typ_oferty = '$_POST[typ]' ";
if (!empty($_POST['miej']))
$wh_mi[] = "miejscowosc = '$_POST[miej]' ";
if (!empty($_POST['powod']))
$wh_mi[] = "metraz >= '$_POST[powod]' ";
if (!empty($_POST['powdo']))
$wh_mi[] = "metraz <= '$_POST[powdo]' ";
if (!empty($_POST['cenaod']))
$wh_mi[] = "cena >= '$_POST[cenaod]' ";
if (!empty($_POST['cenado']))
$wh_mi[] = "cena <= '$_POST[cenado]' ";
if (!empty($wh_mi))
$where_mi = 'WHERE '.implode(' AND ', $wh_mi);
else
$where_mi = '';
$query_mi = "SELECT m_id, typ_oferty, foto1, nr, miejscowosc, dzielnica, ulica, metraz, cena, surowiec, pietro, ilosc_pokoi, waluta FROM mieszkania".$where_mi;