该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
echo "
$conn = odbc_connect("DRIVER={MySQL ODBC 5.2 Unicode Driver};
Server=localhost;Database=test","root","lzw0201");
$stu_id="12570219";//实际中由登陆表单获取;
$con_days=0;//实际中由签到表获取;
$signin_time=time();//实际中由签到表获取;
$sql_select="select signin_time from signin where stu_id=$stu_id";
$sql_insert="insert into signin values($stu_id,$con_days,$signin_time)";
$sql_create="create table signin(stu_id varchar(15) not null,con_days int not null,
signin_time datetime not null)";
if (!$conn){
exit("Connection Failed: " . $conn);}
$rs=odbc_exec($conn,$sql_select);
while (odbc_fetch_row($rs))
{
$signin_time=odbc_result($rs,"signin_time");
if((time()-$signin_time)>0 and (time()-$signin_time)<86400){
echo "window.location.reload(*noRepeat.html*)";
}else if((time()-$signin_time>86400)>86400 and (time()-$signin_time)<172800){
echo "window.location.reload(*con_signinSuccess.php*)";
}elseif((time()-$signin_time)>172800){
echo "window.location.reload(*signinSuccess.html*)";
}
}
odbc_close($conn);
echo "*>";
?>
这是其中php部分的代码,我把一个控件设为button类型,然后写在了php里面,我想实现,从数据库传回数据后(暂且不管这些数据有没有用上),想通过判断数据库里面记录的时间和当前的时间差,分别有三种情况,分别跳向三个页面,但是现在的执行结果只有界面,但是点按钮没有反应。目前程序没有error
二楼上结果图