- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我不断收到错误 PHP fatal error :调用未定义函数 mysqli_stmt_get_result()。我使用的是 PHP 5.6 版,并在我的托管服务提供商 c 面板中启用了扩展名 mysqlind,但我不明白为什么我仍然收到此错误。我研究并发现每次我需要启用 mysqli nd 才能使用 mysqli_stmt_get_result。任何人都可以协助/教导我做错了什么。谢谢。
注册.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 native 驱动程序时试图找出为什么这不起作用的尖叫数小时。这是因为您需要确保启用两个 native 驱动器。如果您希望使用此功能,则需要在您的服务器上启用 mysqlnd 和 nd_mysqli。
否则仅启用 mysqlnd native 驱动程序不包括 mysqli_stmt_get_result 函数,因为这显然位于 nd_mysqli native 驱动程序中。不幸的是,大多数文档只讨论 mysqlnd native 驱动程序。
启用两个 native 驱动程序后,此功能将按照文档说明工作。
哦,在我的托管服务器上,您需要禁用/取消选中 mysqli 才能启用 nd_mysqli。
关于PHP fatal error : Call to undefined function mysqli_stmt_get_result(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45001819/
我准备好的语句在 PHP 5.4 的 MAMP 中工作得很好,不需要调整 php.ini。在我的 GoDaddy 网站上,相同的代码失败并显示: Fatal error: Call to undefi
在 php 文档中它说: mysqli_stmt_store_result — Transfers a result set from a prepared statement. mysqli_stm
我试图绑定(bind)参数(为了安全),然后将结果放入一个数组中,所以我创建了如下代码。问题是它不起作用:$arr 为空。 (顺便说一句,我知道 getList 中的查询有效。) if ($stmt
我有一个 MySQL 查询一直在运行,直到我更改它以使用准备好的语句。我不明白为什么会出现此错误: mysqli_fetch_assoc() expects parameter 1 to be mys
这个问题在这里已经有了答案: MySQLi get_result alternative for PHP 5.3 上可用的 mysqli_stmt_get_result 未定义函数?这是代码:
这个问题在这里已经有了答案: MySQLi get_result alternative for PHP 5.3 上可用的 mysqli_stmt_get_result 未定义函数?这是代码:
我不断收到错误 PHP fatal error :调用未定义函数 mysqli_stmt_get_result()。我使用的是 PHP 5.6 版,并在我的托管服务提供商 c 面板中启用了扩展名 my
我正在运行一个安装了 php 5.5.3 的 apache2 本地开发服务器。由于某种原因,我收到错误 Fatal error: Call to undefined function mysqli_s
我是一名优秀的程序员,十分优秀!