PHP错误:“无法通过引用传递参数2”

我只需要这个不太了解的PHP错误的帮助:


致命错误:在第13行的/web/stud/openup/inactivatesession.php中无法通过引用传递参数2


<?php


error_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();


?>

这个错误是什么意思?如何解决此错误?


呼唤远方
浏览 521回答 2
2回答

白猪掌柜的

首先,DATE_FORMAT当您要比较日期时不应该使用,因为DATE_FORMAT将其更改为字符串不再是日期,UPDATE Session&nbsp;SET Active = ?&nbsp;WHERE SessionDate <= ?第二,首先将值存储在变量中,然后将其传递给参数$createDate = mktime(0,0,0,09,05,date("Y"));$selectedDate =&nbsp; date('d-m-Y', ($createDate));$active = 0;$sql = "UPDATE Session SET Active = ? WHERE SessionDate <= ?";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$update = $mysqli->prepare($sql);$update->bind_param("is", $active, $selectedDate);&nbsp;&nbsp;$update->execute();
打开App,查看更多内容
随时随地看视频慕课网APP