I need to check username in my mysql database whether the usernsme is present or not. Below is my php code. When I enter username it shows Fatal error: Call to a member function bind_param() on boolean in ...
This is php code:
<?php
if (isset($_POST['submit'])) {
$mobile = $_POST['mobile'];
$sql = 'SELECT `mobile_message`
WHERE `mobile` = ?';
// Prepare the SQL statement for execution.
$statement = $connection->prepare($sql);
$bound = $statement->bind_param('s', $mobile);
// Execute the prepared statement.
$statement->execute();
$statement->store_result();
if($statement->num_rows > 0) {
$_SESSION['e']="This username is already exist. Please try different.";
header('location:sign.php');
exit;
}
}
?>