Dzieki ale jest maly problem:
SELECT *
FROM $tabela WHERE IF($_typ!='','typ='$_typ'','')
MySQL sie pluje, ze niby za duzo apostrof w wyrazeniu ale gdy zostawie
'typ=$_typ' to otatecznie zapytanie bedzie wygladalo WHERE typ = CB i tutaj
bedzie sie plul, ze nie ma takiej kolumny CB (musi byc w apostrofach)...
A tak wogole to sytuacja wyglada tak:
Mam pobrane z tabeli dane i sa ladnie wyswietlone na stronce.
Jednakze na stronce znajduje sie formularz z 3 polami <select> i chce by dane
z tabeli byly odpowiednio "filtrowane" w zaleznosci od tego co zostalo
wybrane w polach <select>
Tymczasowo zrobilem to metoda duzej ilosci sprawdzan co zostalo wybrane
z pol <select> i w zaleznosci od tego, przygotowalem mnostwo roznych wersji zapytan
SQL - dziala ale skrypt obslugujacy ten formularz zajmuje naprawde duzo

Tak to wyglada teraz:
<?php
$_typ = $_POST[styp];
$_system = $_POST[ssystem];
$_mapa = $_POST[smapa];
if (($_typ=='') && ($_system=='') && ($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (!($_typ=='') && ($_system=='') && ($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (typ = '$_typ')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (!($_typ=='') && !($_system=='') && ($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (typ = '$_typ' and system = '$_system')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (!($_typ=='') && !($_system=='') && !($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (typ = '$_typ' and system = '$_system' and mapa = '$_mapa')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (!($_typ=='') && ($_system=='') && !($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (typ = '$_typ' and mapa = '$_mapa')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (($_typ=='') && !($_system=='') && ($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (system = '$_system')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (($_typ=='') && !($_system=='') && !($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (system = '$_system' and mapa = '$_mapa')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
if (($_typ=='') && ($_system=='') && !($_mapa=='')) {
$query = \"select * from \".$this->prefix.\"clanwars where (mapa = '$_mapa')\";
$query .= \" order by time desc limit $start,{$this->show}\";
} // end if
?>
http://www.hordasquad.com/web/clanwars.phpPS. Co do warunku w zmiennej - nie wiem czemu ale korszystajac z podanego
przykladu zawsze zmienna otrzymywala wartosc taka jak przy warunku=true