我得到一個錯誤(這樣明顯的錯誤)
調用一個成員函數bind_param()一個非對象...
我想檢查用戶在驗證他的信息時是否提供了他的信息。如果沒有,這是一個成功的回聲,但如果是的話,那麼我得到那個錯誤...我的php代碼:
<?php
if(isset($_POST['configured'])){
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$username = $_SESSION['username'];
$stmt = $mysqli->prepare("SELECT gender FROM members WHERE username = ?");
$stmt->bind_param('s', $username);
$stmt->bind_result($gender);
$stmt->execute();
while ($stmt->fetch()){
if(empty($gender)){
echo "<font color='#DB4D4D'>Verification failed! Please provide your information and try again...</font>";
} else {
$_POST['configured'] = 1;
$sql = "
UPDATE members
SET configured = ?
WHERE username = ?
";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param('ss', $_POST['configured'], $_SESSION['username']); // This is the error line
$ok = $stmt->execute();
if ($ok == TRUE) {
echo "<p><font color='#00CC00'>Your information has been verified.</font><p>
<form action='index.php'> <input type='submit' class='buttondiv' value='Continue to Home Page'>";
} else {
echo "Error: " .$stmt->error;
}
}
}
}
?>
問題在哪裏?
BTW:錯誤線是不是不正確本身..必須有別的事情上......
請修復您的代碼縮進,這將使問題更容易追蹤。 – 2015-04-02 21:21:47
壓痕有什麼問題?你的意思是最後有3個括號? – 2015-04-02 21:24:59
從第一行開始,縮進很糟糕,使代碼難以遵循。 FIFY。 – 2015-04-02 21:25:54