dimanche 10 mai 2015

How to write availability using SQL?

I write SQL for check availability room using date in and date out. But the code only read the first data and not compare with another date in date out. Can someone help me?

$sql = "SELECT DISTINCT roomid,type,price,description,picture FROM reservation WHERE '$datein' > dateout AND '$dateout' > dateout AND  dateout <'$dateend' OR '$datein' < dateout AND '$dateout' < dateout AND  dateout >'$dateend';";
$sql.= "SELECT roomid,type,price,description,picture FROM room WHERE roomid NOT IN(SELECT roomid FROM reservation)";

Aucun commentaire:

Enregistrer un commentaire