我有以下代码:
<?php
session_start();
echo $_SESSION['Username'];
$mysqli = new mysqli('****','****','****','****');
if($mysqli->errno)
{
mail("**@yahoo.com", "***/Account.php Connection Error", $mysqli->error . "\nUser: " . $_SESSION['Username']);
}
else
{
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Expires, Expires WHERE EMail=?");
$stmt->bind_param('s', $_SESSION['Username']);
$stmt->execute();
$stmt->bind_result($FirstName, $LastName, $Expires);
$stmt->store_result();
while($row = $stmt->fetch())
{
....
我的行为非常奇怪。我收到错误Fatal error: Call to a member function bind_param() on a non-object in /home/content/42/7401242/html/****/Account.php on line 12
我在许多其他页面上使用此EXACT代码,它完美无缺。有什么想法我可能会随机收到这个错误吗?
答案 0 :(得分:1)
您错过了表名
之前的FROM
SELECT FirstName, LastName, Expires FROM Expires WHERE EMail=?
答案 1 :(得分:1)
我不知道您是否使用电子邮件绑定用户名。而且你也缺少FROM
条款
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Expires from Expires WHERE EMail=?");
$stmt->bind_param('s', $_SESSION['Username']);
^^^^^^^^^^-----------------be sure if its email variable