我一直在嘗試一切超過4小時,並將錯誤固定到此代碼段。你能告訴我這裏可能有什麼錯嗎?Php Mysqli內部錯誤
<?php
include_once 'database.php';
class Model {
public $db;
public $data;
public $data_item = array();
public function output(){
$this->db = new mysqli($db_servername, $db_username, $db_password, $db_name, $db_port);
$this->data = $this->db->query('SELECT * FROM `tbl_restaurants`');
while($row = $this->data->fetch_assoc()){
$this->data_item['res_id'] = $row['res_id'];
}
return $this->data_item['res_id'];
}
}
$obj = new Model;
echo $obj->output();
?>
'tbl_restaurants'刪除。引用和嘗試。不要刪除第一個和最後一個報價 –
@anantkumarsingh它們不是引號。 –
從哪裏獲得變量'$ db_servername' ...?可能是這些變量的範圍是原因。 –