[請益] 限制同一天預約時段不能超過兩個
各位好
我是新手,我想弄一個預約系統
抓了一個程式來修改
我的需求是一天有早中晚三個時段
同一個人不能預約超過兩個時段
以下是我寫的程式 但是卻沒效果
可否請高手們提示一下如何修改呢
$days=$_GET['day'];
$months=$_GET['month'];
$years=$_GET['year'];
#將網址列的參數抓出來,此為預約該天的日期
$users=getUserName();
#取得目前使用者所登入的帳號名字
$roomid=$_GET['room'];
#取得目前所在的預約房間號碼
$now = mktime("","","", $months,$days,$years);
#將該天的時間轉成秒數 (因為程式本身都將所有時間轉成秒數了)
$sql = "select create_by, start_time, room_id, count(create_by) from
$tbl_entry group by create_by where create_by
like '$users' and room_id='$roomid' and (start_time<=$now+300)
and (start_time >= $now-300)" ;
#同一天的早中晚start time相差正負300,以上是為了讓
相同使用者 相同房間 搜尋的start time同一天內的次數做統計
if ( $count(create_by)> 2 )
{
showAccessDenied($day, $month, $year, $area);
exit;
}
#如果所統計的次數超過兩次,就會強迫exit
請教上面哪邊語法有錯誤呢?????
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.23.199
PHP 近期熱門文章
PTT數位生活區 即時熱門文章