我已经创建了Web服务,并在localhost上测试了所有Web服务,并且工作正常。但是,当我将其上传到godaddy时,我正在“收到500个内部服务器错误”。
在godaddy上搜索错误日志后,我在日志文件中发现以下错误:
PHP Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::get_result() in /home/yohrn82cmt3j/public_html/webservices/include/DB_Functions.php:273 .
这是我在DB_Functions.php中使用的函数。
私人$ conn;
// constructor
function __construct() {
require_once 'DB_Connect.php';
// connecting to database
$db = new Db_Connect();
$this->conn = $db->connect();
}
public function getUAdminByEmailAndPassword($admin_email, $admin_password) {
$stmt = $this->conn->prepare("SELECT * FROM tbl_admin WHERE admin_email = ?");
$stmt->bind_param("s", $admin_email);
if ($stmt->execute()) {
$admin = $stmt->get_result()->fetch_assoc(); **// Here is error**
$stmt->close();
// verifying user password
$salt = $admin['salt'];
$encrypted_password = $admin['admin_password'];
$hash = $this->checkhashSSHA($salt, $admin_password);
// check for password equality
if ($encrypted_password == $hash) {
// user authentication details are correct
return $admin;
}
} else {
return NULL;
}
}
这是DB_Connect.php代码。
class DB_Connect {
private $conn;
// Connecting to database
public function connect() {
require_once 'include/Config.php';
// Connecting to mysql database
$this->conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
// return database handler
return $this->conn;
}
}
但是相同的api在localhost上工作正常。即使我使用post api,条目也会在数据库中注册,但是当我尝试获取最新插入的记录时仍然出现500错误。
请指导我或给我参考。