gpt4 book ai didi

PHP脚本错误

转载 作者:太空宇宙 更新时间:2023-11-03 11:15:15 24 4
gpt4 key购买 nike

我收到这个错误:

Fatal error: Call to a member function query() on a non-object in C:\EasyPHP-5.3.6.0\www\Database Manager\install\registration.php on line 18

这是我的代码:

<?php
include("../sql_information.php");

class infos {

private $sql_initialize;

function login_details() {

$sql_initialize = new MySQLDatabase();
$sql_initialize;
user_name='$register_user_name'";
$queryresult = $this->sql_initialize->query($sql);


if ($sql_initialize->fetchArray($queryresult)) {
$errors[] = "Username already taken";
}

if ($register_password !== $confirm_password) {
$errors[] = "Passwords mismatch";
}

if (!$errors) {
//$register_password = mysql_real_escape_string($register_password);
$sql = "INSERT INTO `data_manager`.`user_accounts` (`id`, `user_name`, `password`) VALUES (NULL, '$register_user_name', '$register_password')";
mysql_query($sql);
print "registered !";
//header("Location: complete.php");
exit;
} else {
foreach ($errors as $err) echo $err;
}
}
}
?>

最佳答案

login_details 的第一行中,您正在设置局部变量 $sql_initialize。您需要改为设置 $this->sql_initialize

关于PHP脚本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5526621/

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