根据输入调整一周中的几天

时间:2015-03-03 09:55:05

标签: php mysql

我想将事件设置为输入日。例如,如果用户在星期二插入查询并且主题的时间表是星期五,我该如何创建将在每个星期五激活的事件?

$sql = "SELECT * FROM subjects where day='$day' and starttime='$starttime' and endtime='$endtime' and yearlevel='$yearlevel' ";
$result =$conn->query($sql);
$row_cnt = $result->num_rows;
if ($row_cnt < 1) { 

    $add="INSERT INTO subjects (subjects, day, starttime, endtime, yearlevel)
            VALUES ('$subjects','$day','$oper','$oper1','$yearlevel')";
    $result2 =$conn->query($add);


$event="CREATE EVENT {$subjects}attendance ON SCHEDULE EVERY 1 WEEK
 STARTS 'CURDATE() 06:00:00'
 ";
}

0 个答案:

没有答案