How to limit a user to only 5 database rows - 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: How to limit a user to only 5 database rows (/showthread.php?tid=60148) |
How to limit a user to only 5 database rows - El Forum - 01-25-2014 [eluser]alex646[/eluser] Hey Guys, I'm trying to only allow a user to only have 5 database rows, e.g one user should only be allowed to have no more than 5 db rows. table id data_id 1 123 2 124 3 125 4 126 5 127 So if any user will have 5 records in the db, I want to prevent them from entering new database records. I've tried to use: ($this->db->count_all_results() <5) {continue inserting new data} but can't get anything to work : ( I'm a noob I appreciate if somebody can give me any clues! How to limit a user to only 5 database rows - El Forum - 01-26-2014 [eluser]InsiteFX[/eluser] See the User Guide - Active Record get() or get_where() methods, limit and offset. |