I'm new to using php mysqli prepared statements. No matter what I try I always get this error message.
Fatal error: Call to undefined function mysqli_stmt_init() in...(etc)
I have close my database link further below in my code, it isn't show here. Here is my code:
$link = mysqli_connect($mysql_host, $mysql_user, $mysql_password, $mysql_database);
if (mysqli_connect_errno()) {
echo 'We\'re having problems connecting right now. Please try again later.';
exit();
}
$email_query = mysqli_stmt_init($link);
if(mysqli_stmt_prepare($email_query, "SELECT * FROM users WHERE email=?")){
mysqli_stmt_bind_param($email_query, "s", $email);
mysqli_stmt_execute($email_query);
mysqli_stmt_store_result($email_query);
$exists_email = mysqli_stmt_num_rows($email_query);
mysqli_stmt_close($email_query);
The line number in the error corresponds to the init line in the code.
You don't need
mysqli_stmt_init()
. Just issue your prepared statement directly.