if($type==0 && $province==0 && $keyword==""){
$query = mysql_query("SELECT * FROM company WHERE showStat=1 ORDER BY dateShow DESC");
}
else
if($type!=0 && $province==0 && $keyword==""){
$query = mysql_query("SELECT * FROM company WHERE idType=$type AND showStat=1 ORDER BY dateShow DESC");
}
else
if($type==0 && $province!=0 && $keyword==""){
$query = mysql_query("SELECT * FROM company WHERE provinceID=$province AND showStat=1 ORDER BY dateShow DESC");
}
else
if($type==0 && $province==0 && $keyword!=""){
$query = mysql_query("SELECT * FROM company WHERE nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
else
if($type!=0 && $province!=0 && $keyword==""){
$query = mysql_query("SELECT * FROM company WHERE idType=$type AND provinceID=$province AND showStat=1 ORDER BY dateShow DESC");
}
else
if($type!=0 && $province==0 && $keyword!=""){
$query = mysql_query("SELECT * FROM company WHERE idType=$type AND nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
else
if($type==0 && $province!=0 && $keyword!=""){
$query = mysql_query("SELECT * FROM company WHERE provinceID=$province AND nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
else{
$query = mysql_query("SELECT * FROM company WHERE provinceID=$province AND idType=$type AND nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
if($type!=0 || $province!=0 || $keyword!=""){
$query = mysql_query("SELECT * FROM company WHERE provinceID=$province AND nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
else{
$query = mysql_query("SELECT * FROM company WHERE provinceID=$province AND idType=$type AND nameComp LIKE'%$keyword%' OR positionW LIKE'%$keyword%' AND showStat=1 ORDER BY dateShow DESC");
}
if ($type==0){
if ($province==0){
if ($keyword==""){
$query = mysql_query("SELECT * FROM company WHERE showStat=1 ORDER BY dateShow DESC");
}else{
$query = mysql_query("SELECT * FROM company WHERE idType=$type AND showStat=1 ORDER BY dateShow DESC");
}
}else{
...
}
}else{
...
}