[eluser]Unknown[/eluser]
Hi all,
I have successfully used CI pagination library from 1.7 and now I am trying to use the 2.0 version but my "old" method seems to no longer work and I get
Quote:A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysql_result could not be converted to string
Filename: controllers/Phones.php
Line Number: 66
and
Quote:A PHP Error was encountered
Severity: Notice
Message: Object of class CI_DB_mysql_result to string conversion
Filename: controllers/Phones.php
Line Number: 66
Here is my Model(well at least the function being called)
Code:
function getAllPhoneDetails($limit = 5, $offset = 0){
$query ="SELECT manufacturer.name as manufacturer,phone.model, " .
"phone.phoneID, phone.IMEI, status.name as status ".
"FROM phone, status, manufacturer " .
"WHERE phone.status = status.statusID AND " .
"manufacturer.manufacturerID = phone.manufacturerID ".
"LIMIT ".$limit." OFFSET ".$offset."";
$result = $this->db->query($query);
if ($result->num_rows() > 0){
return $result;
}else{
return null;
}
}
my controller:
Code:
function paginate($data){
if($this->uri->segment(3) == null){
$data['phoneDetails'] = $this->phone_Model->getAllPhoneDetails($config['per_page'], 0 );
}else{
$data['phoneDetails'] = $this->phone_Model->getAllPhoneDetails($config['per_page'], $this->uri->segment(3) );//this is line 66
}
$config['total_rows'] = 200;//$this->phone_Model->getAllPhoneDetails()->num_rows();//get ALL rows
$this->pagination->initialize($config);
return $data;
}
Any ideas on what I am doing wrong?