我只是需要帮助解决这个我不太明白的 PHP 错误:
I just need help on this PHP error which I do not quite understand:
致命错误:无法在第 13 行的/web/stud/openup/inactivatesession.php 中通过引用传递参数 2
Fatal error: Cannot pass parameter 2 by reference in /web/stud/openup/inactivatesession.php on line 13
<?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();
?>
这个错误是什么意思?如何修复此错误?
What does this error mean? How can this error be fixed?
该错误意味着第二个参数应该是对变量的引用.
The error means that the 2nd argument is expected to be a reference to a variable.
由于您处理的不是变量,而是值 0 的整数,因此会产生上述错误.
Since you are not handing a variable but an integer of value 0, it generates said error.
要避免这种情况,请执行以下操作:
To circumvent this do:
$a = 0;
$update->bind_param("is", $a, $selectedDate); //LINE 13
如果您想了解正在发生的事情,而不是仅仅修复您的致命错误
,请阅读以下内容:http://php.net/manual/en/language.references.pass.php
In case you want to understand what is happening, as opposed to just fixing your Fatal error
, read this: http://php.net/manual/en/language.references.pass.php
这篇关于PHP 错误:“无法通过引用传递参数 2"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!