作者Floatcross (小天使落跑了!!??)
看板PHP
标题[请益] 限制同一天预约时段不能超过两个
时间Wed Oct 18 23:02:36 2006
各位好
我是新手,我想弄一个预约系统
抓了一个程式来修改
我的需求是一天有早中晚三个时段
同一个人不能预约超过两个时段
以下是我写的程式 但是却没效果
可否请高手们提示一下如何修改呢
$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