Pagination problems |
[eluser]buckboru[/eluser]
Hi, I have been looking at examples of using pagination. I am trying to implement this but i'm having some issues. Basically i get an error on this $config['total_rows'] = $this->db->count_all('tstmis.phoned01'); saying that Call to a member function count_all() on a non-object This is what my controller looks like Code: <?php Code: $query = $this->db->get('tstmis.phoned01'); Thanks
[eluser]Thorpe Obazee[/eluser]
[quote author="buckboru" date="1220045396"] Below works fine in my model Code: $query = $this->db->get('tstmis.phoned01'); Thanks[/quote] Sorry but I don't know where this comes in. where in the controller do you call this?
[eluser]buckboru[/eluser]
This comes from my Model controller. The whole code being <?php class Phone_model extends Model { function get_phoneList() { $query = $this->db->get('tstmis.phoned01'); foreach ($query->result_array() as $row) { $result[] = $row; } return $result; } }
[eluser]Thorpe Obazee[/eluser]
[quote author="buckboru" date="1220045396"] <?php $this->load->library('pagination'); $this->load->database(); $config['base_url'] = base_url().'index.php/phonelist/list_users/'; $config['total_rows'] = $this->db->count_all('tstmis.phoned01');[/quote] try loading the database library first.
[eluser]buckboru[/eluser]
Well that made progress, but I still have a problem. I am accessing a DB2 database sitting on an IBM AS400. I have noticed that when I do something like this <td><?=$row['LAST_NAME']?></td> <td><?=$row['FIRST_NAME']?></td> <td><?=$row['DEPARTMENT']?></td> <td><?=$row['EXTENSION']?></td> I have to have the field name in UPPERCASE otherwise i receive a Severity: Notice Message: Use of undefined constant DB2_AUTOCOMMMIT_ON - assumed 'DB2_AUTOCOMMMIT_ON' Filename: db2c/db2c_driver.php I am know receiving this error on the $config['total_rows'] = $this->db->count_all('TSTMIS.PHONED01');
[eluser]Thorpe Obazee[/eluser]
DB2? I really don't know about that. I didn't even know CI has a driver for DB2.
[eluser]buckboru[/eluser]
Yeah, someone wrote one that can be found in the WIKI. Thanks for your help. I have made some progress. Maybe someone else will chime in.
[eluser]Thorpe Obazee[/eluser]
You mean this one? http://codeigniter.com/wiki/DB2_Database_Driver/ It's built for CI 1.5.4 Somehow, it might not be updated anymore for 1.6.3
[eluser]buckboru[/eluser]
Yep, thats the one. I hadn't realized it was written for an older version.
[eluser]buckboru[/eluser]
Let me run this by you as i've been debugging and debugging trying to make heads or tails of the problem. In my db2c.driver.php Count_all() Code: function count_all($table = '') However it blows on the next line return$row->numrows with a message of Undefined property: stdClass::$numrows any thoughts or guidance as to what to look for. |
Welcome Guest, Not a member yet? Register Sign In |