|
 |
|
ถามหน่อยครับ คือผมดึงวันที่จากฐานข้อมูลมาเปรีบยเทียบ ถ้าวันที่ในฐานข้อมูลมากกว่า หรือ น้อยกว่า |
|
 |
|
|
 |
 |
|
คือผมดึงวันที่จากฐานข้อมูลมาเปรีบยเทียบ ถ้าวันที่ในฐานข้อมูลมากกว่า หรือ น้อยกว่า หรือ เท่ากับวันที่กำหนด
ให้ลิ้งไปหน้าที่ต้องการ ผลที่ออกมาคือลิ้งได้
แต่ถ้ามันไม่มีข้อมูลในฐานข้อมูลมันจะไม่ทำอะไรเลยครับ
อยากให้ถ้าไม่มีข้อมูลในฐานข้อมูลให้มันลิ้งไปหน้าที่ต้องการอ่ะครับ
Code (PHP)
<?
$date=date('Y-m-d');
$sql="select date_out from reserve_detail WHERE house_id = '$house1' ORDER BY reservedetail_id DESC limit 1 ";
$result=mysql_db_query($dbname, $sql);
while(list($d)=mysql_fetch_array($result)){
$day1=explode('-', $date_in1);
?>
<?php
function compareDate($date1,$date2) { //เอาไว้เช็ควันที่ว่าซ้ำไหม
$arrDate1 = explode("-",$date1);
$arrDate2 = explode("-",$date2);
$timStmp1 = mktime(0,0,0,$arrDate1[1],$arrDate1[2],$arrDate1[0]);
$timStmp2 = mktime(0,0,0,$arrDate2[1],$arrDate2[2],$arrDate2[0]);
if ($timStmp1 == $timStmp2) {
echo "<br><p align=center><span class=style1>วันที่เข้าพักซ้ำ กรุณากรอกใหม่อีกครั้ง</span></p>";
echo "<p align=center><input name=Submit type=submit class=style2 onclick=javascript:window.location.replace('unsession_reserve.php') value=กลับไปกรอกข้อมูลใหม่ /></p>";
} else if ($timStmp1 > $timStmp2) {
echo"<meta http-equiv=refresh content=0;URL=process_reserve.php>";
}else if ($timStmp1 < $timStmp2) {
echo "<br><p align=center><span class=style1>วันที่เข้าพักซ้ำ กรุณากรอกใหม่อีกครั้ง</span></p>";
echo "<p align=center><input name=Submit type=submit class=style2 onclick=javascript:window.location.replace('unsession_reserve.php') value=กลับไปกรอกข้อมูลใหม่ /></p>";
}
}
echo compareDate("$date_in1","$d");
?>
<?
}
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-11-13 22:06:00 |
By :
motoadd |
View :
1387 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 05
|