一切似乎都很好,但我不断收到以下错误:
遇到 PHP 错误严重性:通知
消息:试图获取非对象的属性
文件名:models/ordermodel.php
行号:24
遇到 PHP 错误严重性:通知
消息:试图获取非对象的属性
文件名:models/ordermodel.php
行号:31
==================================================== ===============
在视图中,我只是回显 $company_name
控制器:
$city = $this->ordermodel->get_city($order_reference);
$customerCompanyName = $this->ordermodel->get_company_name($order_reference);
$data['company_name'] = $customerCompanyName;
模型:
function get_city($ordernumber) {
$this->db->where('order_number', $ordernumber);
$city = $this->db->get('order');
return $city->row()->city;
}
function get_company_name($ordernumber) {
$this->db->where('order_number', $ordernumber);
$companyname = $this->db->get('order');
return $companyname->row()->company_name;
}