我试图在我的CI系统中获取非对象的属性。
在将我的记录从用户1导航到用户11时,一切正常,但当我导航到最后一个用户12的用户时,我收到此错误通知..
这是我的控制器:
public function index()
{
$data['title']= 'Customer Card';
$data['records'] = $this->customer_model->getAll();
$data['taxcodes'] = $this->customer_model->getAllTaxCodes();
$data['types'] = $this->customer_model->getAllCustomerTypes();
$data['groups'] = $this->customer_model->getAllCustomerGroups();
$data['groupcodes'] = $this->customer_model->getAllCustomerGroups();
$shown_id = $this->uri->segment(3);
if(!is_numeric($shown_id)){
$shown_id = 0;
}
if($shown_id == ""){
$shown_id = 1;
}
$data['info'] = $this->customer_model->fetch_customers(1, $shown_id);
$data['last_id'] = $this->customer_model->last_customer();
$this->load->view('include/header', $data);
$this->load->view('include/navbar', $data);
$this->load->view('customer_view', $data);
$this->load->view('include/sidebar', $data);
$this->load->view('include/footer', $data);
}
查看:
<?php
$customer_id = $info->customercode_id;
$customer_code = $info->customercode;
$customer_name = $info->customername;
$customer_type = $info->typedescription;
$customer_group = $info->customergroup;
$customer_address = $info->customeraddress;
$customer_addressalt = $info->customeraddressalt;
$customer_grp_desc = $info->groupdescription;
$customer_phone1 = $info->phone1;
$customer_phone2 = $info->phone2;
$customer_fax = $info->fax;
$customer_email = $info->email;
$customer_website = $info->website;
$tax_code = $info->taxcode;
?>
型号:
function getAllCustomerGroups()
{
$query = $this->db->query('SELECT customergroup, description FROM customergrouplist');
return $query->result();
}
function getAllTransactionTypes()
{
$query = $this->db->query('SELECT description FROM transactioncodelist');
return $query->result();
}
function getAllCustomerTypes()
{
$query = $this->db->query('SELECT customertypecode, customertypedescription FROM customertype');
return $query->result();
}
function getAllTaxCodes()
{
$query = $this->db->query('SELECT tax_id, taxcode FROM tax');
return $query->result();
}
function getAll() {
$query = $this->db->query('SELECT customercode, customername,
customergroup, customertype, customeraddress,
website FROM customercard LIMIT 1');
return $query->result();
}
function getLastID() {
//$query = $this->db->query('SELECT max(customercode_id) FROM customercard');
$query = $this->db->query('SELECT customercode_id FROM customercard ORDER BY customercode_id DESC LIMIT 1');
return $query->row()->customercode_id;
}
public function fetch_customers($limit, $start) {
$this->db->select('
customercard.customercode_id,
customercard.customercode,
customercard.customername,
customercard.customergroup,
customertype.customertypedescription as typedescription,
customercard.customeraddress,
customercard.customeraddressalt,
tax.taxcode as taxcode,
customercard.website,
customergrouplist.description as groupdescription,
customercard.phone1,
customercard.phone2,
customercard.fax, customercard.email');
$this->db->limit($limit);
$this->db->order_by('customercode_id');
$this->db->join('customergrouplist','customercard.customergroup=customergrouplist.customergroup');
$this->db->join('customertype','customercard.customertype=customertype.customertypecode');
$this->db->join('tax','customercard.tax_id=tax.tax_id');
$this->db->where('customercode_id', $start);
$query = $this->db->get('customercard');
//echo $this->db->last_query();
//echo $query->num_rows();
if ($query->num_rows() > 0) {
$row = $query->row();
$data = $row;
return $data;
} else {
return false;
}
}
public function last_customer(){
$this->db->select('customercode_id');
$this->db->limit(1);
$this->db->order_by('customercode_id','DESC');
$query = $this->db->get('customercard');
$row = $query -> row();
return $row->customercode_id;
}
我的编纂中似乎有什么问题?任何的想法?我很乐意感谢你的帮助。感谢。