I'm getting an error (so obvious error)
Call to a member function bind_param() on a non-object...
I want to check if user has provided his information when verifying his information. If no, it's a successful echo, but if yes, then I get that error... My php code :
<?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;
}
}
}
}
?>
Where is problem?
BTW: The error line is not incorrect itself.. there has to be something else going on...