gpt4 book ai didi

php-7.2 - PHP 7.2.7 警告 : Use of undefined constant

转载 作者:行者123 更新时间:2023-12-03 22:50:12 26 4
gpt4 key购买 nike

因此,在我单击 index.php resgitration 表单上的提交后。
这一切都很好,电子邮件和密码都从我的数据库中保存了下来。但是有一个警告让我很恼火。

Use of undefined constant result_query - assumed 'result_query' (this will throw an Error in a future version of PHP)



出现。

它说它在第 26 行。

这是我的 function.php 上的代码,警告来自哪里。
<?php include "db.php" ?>
<?php

function createAccount(){
global $connection;
if(isset($_POST['submit'])){

$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];

$name = mysqli_real_escape_string($connection, $name);
$passowrd = mysqli_real_escape_string($connection, $password);

$hashFormat = "$2y$10$"; // blowfish encryting
$salt = "dikoalampasswordqweqwe";
$hashAndSalt = $hashFormat . $salt;

$password = crypt($password, $hashAndSalt);

$query = "INSERT INTO accounts_registered(name, email, password) ";
$query .= "VALUES ('$name', '$email', '$password')";

$result_query = mysqli_query($connection, $query);

if(!result_query){
die("Query Failed" . mysqli_error($connection));
}
else {
$message = "Account Registered";
echo "<script type='text/javascript'>alert('$message');</script>";

}
}
}


?>

最佳答案

if(!result_query)应该是 if(!$result_query)

关于php-7.2 - PHP 7.2.7 警告 : Use of undefined constant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51731048/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com