ผมจะทำเว็ปที่มี database อยู่แล้วใช้ sql เป็นตัว query ข้อมูลออกมาโชว์ครับ โดยอันนี้ทดลองใน mysql ผลลัพธ์ได้ออกมาที่ต้องการ
MYSQL
SELECT * FROM dialed,geo
where dialed.`time` between '15:00' and '21:00'
and geo.`time` between '08:00' and '24:00'
and dialed.`date` between '2011-02-07' and '2011-02-10'
and geo.`date` between '2011-02-07' and '2011-02-10' ;
$sql1 = "SELECT dialed.*,geo.* FROM dialed,geo
where dialed.date BETWEEN '$y1-$m1-$d1' and '$y1_2-$m1_2-$m1_2'
and dialed.time BETWEEN '$h1-$mi1' and '$h1_2-$mi1_2'
and geo.time BETWEEN '$h2-$mi2' and '$h2_2-$mi2_2'
geo.date BETWEEN '$y2-$m2-$d2' and '$y2_2-$m2_2-$m2_2' ";
$sql1 = "SELECT dialed.* FROM dialed
where dialed.date BETWEEN '$y1-$m1-$d1' and '$y1_2-$m1_2-$m1_2'
and dialed.time BETWEEN '$h1-$mi1' and '$h1_2-$mi1_2'
and geo.'time' BETWEEN '$h2-$mi2' and '$h2_2-$mi2_2'
geo.'date' BETWEEN '$y2-$m2-$d2' and '$y2_2-$m2_2-$m2_2' ";
if('15:00' and '21:00'){
SELECT * FROM dialed
} else if('08:00' and '24:00'){
SELECT * FROM dialed
} else if('2011-02-07' and '2011-02-10'){
SELECT * FROM dialed
} else if('2011-02-07' and '2011-02-10'){
SELECT * FROM dialed
}