存在错误消息:
致命错误:在第 22 行的 /var/www/New/API/Constants.php 中的非对象上调用成员函数 bind_param()
更新了整个 constants.php 这是我在 constants.php 上的代码:
session_start();
if (isset($_SESSION['real_name']))
{
$username = $_SESSION['real_name'];
$InnerJoinQuery = $STD->prepare("
SELECT Users.ID, Users.Password, UserInformation.LastName, UserInformation.Firstname, UserInformation.DOB
FROM Users
INNER JOIN UserInformation
ON Users.ID = UserInformation.UserID WHERE Users.Username = ?");
$InnerJoinQuery->bind_param("s", $username);
$InnerJoinQuery->execute();
$InnerJoinQuery->bind_result($UID, $Password, $LastName, $Firstname, $DOB);
$InnerJoinQuery->fetch();
$_SESSION['UID'] = $UID;
$_SESSION['Password'] = $Password;
$_SESSION['Firstname'] = $LastName;
$_SESSION['LastName'] = $Firstname;
$_SESSION['DOB'] = $DOB;
}
echo $UID."<br>".$Password."<br>".$LastName."<br>".$Firstname."<br>".$DOB;
但:
echo $UID."<br>".$Password."<br>".$LastName."<br>".$Firstname."<br>".$DOB;
退货;
5 xxx 吉尔达里尔 211094
还:
print_r($_SESSION);
数组([real_name] => InhumaneSlayer [Password] => xxx [UID] => 5 [Firstname] => Gill [LastName] => Daryl [DOB] => 211094)
以上是预期输出
哪个是预期的?所以 bind_param 失败但 bind_results 正在收集正确的信息?