PHP致命错误:调用未定义函数mysqli_stmt_get_result() [英] PHP Fatal error: Call to undefined function mysqli_stmt_get_result()
问题描述
我一直收到错误PHP致命错误:调用未定义函数mysqli_stmt_get_result().我使用的是PHP 5.6版,并在主机提供商c面板中启用了扩展名mysqlind,但我不知道为什么仍然出现此错误.我进行了研究,发现每次需要启用mysqli nd才能使用mysqli_stmt_get_result.任何人都可以协助/教我在做什么错.谢谢.
I keep getting the error PHP Fatal error: Call to undefined function mysqli_stmt_get_result(). I am using PHP version 5.6 and have enabled the extension mysqlind in my hosting provider c panel but I can't figure out why I am still getting this error. I have researched and found every time that I need to have mysqli nd enabled to use mysqli_stmt_get_result. Can anyone assist/teach what I am doing wrong. Thank you.
SIGNUP.PHP:
SIGNUP.PHP:
<?php
session_start();
include '../dbh.php';
$respond = array(
'status' => true,
'message' => 'There was an error',
'redirect',
'errors'
);
if (isset($_POST['submit'])) {
$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$errorEmpty = false;
$errorEmail = false;
if (empty($first) || empty($last) || empty($email) || empty($pwd)) {
$respond['errors'][] = "Please fill out all fields!";
$respond['errorEmpty'] = true;
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$respond['errors'][] = "Please enter a valid email address!";
$respond['errorEmail'] = true;
} else {
$sql = "SELECT email FROM user WHERE email= ? ";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, 's', $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt); //This is where I getting my error
$num_rows = mysqli_num_rows($result);
if ($num_rows > 0) {
$respond['errors'][] = "That email address already exists!";
$respond['errorEmail'] = true;
}
else {
$encryptpwd = password_hash($pwd, PASSWORD_DEFAULT);
$sql = "INSERT INTO user (first, last, email, pwd) VALUES (?,?,?,?)";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, 'ssss', $first, $last, $email, $password_hash);
if (mysqli_stmt_execute($stmt)) {
$userID = mysqli_insert_id($conn);
$status = 1;
$sql2 = "INSERT INTO profileImg (email, status) VALUES(?,?)";
$stmt2 = mysqli_prepare($conn, $sql2);
mysqli_stmt_bind_param($stmt2, 'si', $email);
mysqli_stmt_execute($stmt);
$_SESSION['id'] = $userID;
$respond['redirect'] = "../profile.php?id=$userID";
}
}
}
}
echo json_encode($respond);
?>
推荐答案
您是否已正确安装mysqlnd驱动程序?根据手册中的评论:
Do you have the mysqlnd driver properly installed? Per a comment in the Manual:
如果您没有安装/加载mysqlnd,您将得到一个 尝试调用"mysqli_stmt_get_result()"时未定义的引用.
If you don't have mysqlnd installed/loaded whatever, you will get an undefined reference when trying to call "mysqli_stmt_get_result()".
此外,在此处和<.
Also, there are discussions about this issue here and here.
最后,这是一个论坛,其中讨论了有关使用驱动程序的信息使用cpanel,您可能会发现它有用.
Lastly, here's a forum discussing info pertaining to using the driver with cpanel that you may find useful.
这篇关于PHP致命错误:调用未定义函数mysqli_stmt_get_result()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!