erro iin adding offset and limit to active record - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: erro iin adding offset and limit to active record (/showthread.php?tid=40464) |
erro iin adding offset and limit to active record - El Forum - 04-09-2011 [eluser]mardon[/eluser] Hi in my script I want to add pagination and I edit model to Code: function getAll($limit = 0, $offset = 0) { but after edit i have the error: A Database Error Occurred Error Number: 1146 Table 'certifikat.3' doesn't exist SELECT `certs`.*, `users`.`prijmeni` as jmeno FROM (`certs`, `3`) JOIN `users` ON `certs`.`id_user`=`users`.`id` Filename: C:\dev\www\ci_certifikat\system\database\DB_driver.php Line Number: 330 thx for help with my query erro iin adding offset and limit to active record - El Forum - 04-09-2011 [eluser]toopay[/eluser] $q = $this->db->select('certs.ser_cislo, certs.pocatek, certs.konec, certs.id_user, users.prijmeni as jmeno') ->join('users', 'certs.id_user=users.id') ->limit($limit, $offset) ->get('certs'); erro iin adding offset and limit to active record - El Forum - 04-09-2011 [eluser]Armchair Samurai[/eluser] You're missing the first parameter from get() which should be the table name. AFAIK if you want to use the limit and offset parameters, you'll need to either include the table name with the get() call or use the limit() function. Code: $this->db->select('c.*, u.prijmeni jmeno'); erro iin adding offset and limit to active record - El Forum - 04-09-2011 [eluser]toopay[/eluser] Code: $query = $this->db->select('certs.*, users.prijmeni as jmeno') erro iin adding offset and limit to active record - El Forum - 04-09-2011 [eluser]mardon[/eluser] thx to both, I repair query is and now is OK |