我只需要这个不太了解的PHP错误的帮助:致命错误:在第13行的/web/stud/openup/inactivatesession.php中无法通过引用传递参数2<?phperror_reporting(E_ALL);include('connect.php');$createDate = mktime(0,0,0,09,05,date("Y"));$selectedDate = date('d-m-Y', ($createDate));$sql = "UPDATE Session SET Active = ? WHERE DATE_FORMAT(SessionDate,'%Y-%m-%d' ) <= ?"; $update = $mysqli->prepare($sql);$update->bind_param("is", 0, $selectedDate); //LINE 13$update->execute();?>这个错误是什么意思?如何解决此错误?
2 回答
白猪掌柜的
TA贡献1893条经验 获得超10个赞
首先,DATE_FORMAT当您要比较日期时不应该使用,因为DATE_FORMAT将其更改为字符串不再是日期,
UPDATE Session
SET Active = ?
WHERE SessionDate <= ?
第二,首先将值存储在变量中,然后将其传递给参数
$createDate = mktime(0,0,0,09,05,date("Y"));
$selectedDate = date('d-m-Y', ($createDate));
$active = 0;
$sql = "UPDATE Session SET Active = ? WHERE SessionDate <= ?";
$update = $mysqli->prepare($sql);
$update->bind_param("is", $active, $selectedDate);
$update->execute();
添加回答
举报
0/150
提交
取消