$str="SELECT*from book b inner join room r on b.room=r.rid where book='1' and b.status='1' ";
$re = mysqli_query($dblink, $str);
$num = mysqli_num_rows($re);
$rows = mysqli_fetch_array($re);
$d=$rows[dates];
if ($d<$date) {
while ($rows = mysqli_fetch_array($re)) {
$strs="UPDATE room r set book='0' where rid='".$rows['rid']."'";
$res= mysqli_query($dblink, $strs);
}
}