if($car_no=="1" || $car_no=="2"){ //if 2
$sql="SELECT * FROM log_rent
WHERE log_rent.car_no='$car_no'
AND (
log_rent.log_time_s BETWEEN '$log_time_s' AND '$log_time_e'
OR
log_rent.log_time_e BETWEEN '$log_time_s' AND '$log_time_e')
AND (
log_rent.log_date_s BETWEEN '$log_date_s' AND '$log_date_e'
OR
log_rent.log_date_e BETWEEN '$log_date_s' AND '$log_date_e')";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){ //while
if($row[log_no]!=""){ //if 3
echo"<SCRIPT LANGUAGE='JavaScript'>alert('มีคนจองรถแล้วในช่วงนี้'); window.location='javascript:history.back()';</SCRIPT>";return(false);}//if 3 close
} //while
} //if 2 close
//