这是一个更新表中字段值的脚本。查询后我收到错误:
致命错误:在非对象上调用成员函数close()
<?php
error_reporting(E_ALL);ini_set('display_errors','On');
define('DB_HOST', 'xxxxxx');
define('DB_NAME', 'xxxxxx');
define('DB_USER','xxxxxx');
define('DB_PASSWORD','xxxxxxx');
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die("Failed to connect to MySQL: " . mysqli_error());
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$result = $mysqli->query("update people_table set FirstName = 'Jon' where LastName = 'Smith'") or die($mysqli->error);
$result->close();
?>
$ result是我视图中的一个让我困惑的对象
答案 0 :(得分:1)
我认为这是你需要写的而不是结果对象
$mysqli->close();