php - 注册/登录 mysqli_stmt_get_result() 错误帮助我
问题描述
我怎样才能解决这个问题。下面的错误
致命错误:未捕获错误:调用 /home/s6s88hqcj2py/public_html/includes/functions.inc.php:63 中未定义的函数 mysqli_stmt_get_result() 堆栈跟踪:#0 /home/s6s88hqcj2py/public_html/includes/functions.inc.php( 108):uidExists(对象(mysqli),'qhewqewhqewh','qhewqewhqewh')#1 /home/s6s88hqcj2py/public_html/includes/girisyap.inc.php(16):girisyapUser(对象(mysqli),'qhewqewhqewh',' qewhqewhqew') #2 {main} 在第 63 行的 /home/s6s88hqcj2py/public_html/includes/functions.inc.php 中抛出
包括/functions.inc.php
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
function emptyInputKayitol($name, $email, $username, $pwd, $pwdRepeat){
$result;
if ( empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat) ) {
$result = true;
}
else{
$result = false;
}
return $result;
}
function invalidUid($username){
$result;
if (!preg_match("/^[a-zA-Z0-9]*$/", $username)) {
$result = true;
}
else{
$result = false;
}
return $result;
}
function invalidEmail($email){
$result;
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$result = true;
}
else{
$result = false;
}
return $result;
}
function pwdMatch($pwd, $pwdRepeat){
$result;
if ($pwd !== $pwdRepeat) {
$result = true;
}
else{
$result = false;
}
return $result;
}
function uidExists($conn, $username, $email){
$sql = "SELECT * FROM users WHERE usersUid = ? OR usersEmail = ?;";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../kayitol.php?error=stmtfailed");
exit();
}
mysqli_stmt_bind_param($stmt, "ss", $username, $email);
mysqli_stmt_execute($stmt);
$resultData = mysqli_stmt_get_result($stmt);
if ($row = mysqli_fetch_assoc($resultData)) {
return $row;
}
else{
$result = false;
return $result;
}
mysqli_stmt_close($stmt);
}
function createUser($conn, $name, $email, $username, $pwd){
$sql = "INSERT INTO users (usersName, usersEmail, usersUid, usersPwd) VALUES (?, ?, ?, ?);";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../kayitol.php?error=stmtfailed");
exit();
}
$hashedPwd = password_hash($pwd, PASSWORD_DEFAULT);
mysqli_stmt_bind_param($stmt, "ssss", $name, $email, $username, $hashedPwd);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
header("location: ../kayitol.php?error=none");
exit();
}
function emptyInputGirisyap($username, $pwd){
$result;
if ( empty($username) || empty($pwd) ){
$result = true;
}
else{
$result = false;
}
return $result;
}
function girisyapUser($conn, $username, $pwd) {
$uidExists = uidExists($conn, $username, $username);
if ($uidExists === false) {
header("location: ../girisyap.php?error=wronglogin");
exit();
}
$pwdHashed = $uidExists["usersPwd"];
$checkPwd = password_verify($pwd, $pwdHashed);
if ($checkPwd === false) {
header("location: ../girisyap.php");
exit();
}
else if($checkPwd === true) {
session_start();
$_SESSION["userid"] = $uidExists["usersId"];
$_SESSION["useruid"] = $uidExists["usersUid"];
header("location: ../index.php");
exit();
}
}
解决方案
推荐阅读
- node.js - Node.js npm 没有运行我想要的文件,而是在同一文件夹中运行另一个文件
- python - 由于 try 循环或 while 循环,最高编号查找代码出现错误
- c# - Azure 函数中的时区和夏令时
- node.js - Firebase 函数超时
- html - 当我在 php 上做 foreach 时,如何让卡片添加到一边?
- django - Django从表中检索提交的值
- javascript - 在 Angular 中动态生成视图中的链接
- java - IMB PCF 代理在查询通道状态时返回错误
- java - 如何从“自定义透视”选项(以编程方式)隐藏“菜单可见性”或“工具栏可见性”菜单中的项目可见性
- python - XGBoost python:输入形状错误,特征名称不匹配错误