$key = $_GET["key"];
if($key){
$sql = "SELECT * FROM detail INNER JOIN room ON room.id_room = detail.room_type INNER JOIN status ON status.id_status = detail.status WHERE id_status='3' AND
detail.date_in like '%$key%'
OR detail.cus_name like '%$key%'
OR detail.date_out like '%$key%'
OR status.type like '%$key%'
OR room.room_type like '%$key%'
ORDER BY date_in ASC"
;
}
else{
$sql = "SELECT * FROM detail INNER JOIN room ON room.id_room = detail.room_type INNER JOIN status ON status.id_status = detail.status WHERE id_status='3' ORDER BY date_out ASC ";
}
$query = mysql_query($sql);