I have added a select snippet below. Why am I getting the following error on bind_param()
?
Uncaught Error: Call to a member function bind_param() on boolean
Code:
$sessien = $_POST['xsession'];
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
$query = "SELECT `post` FROM `user` WHERE session=? ORDER BY `thedate` DESC ";
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $sessien);
$stmt->execute();
while ($stmt -> fetch()) {
echo "$post<br>";
}
$stmt->close();
$conn->close();
Mysqli prepare can returns
false
before bind you must check it for errors. look at this article in php.nethttp://php.net/manual/en/mysqli.error.php