Welcome Guest, Not a member yet? Register   Sign In
How to limit a user to only 5 database rows
#1

[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!

#2

[eluser]InsiteFX[/eluser]
See the User Guide - Active Record get() or get_where() methods, limit and offset.




Theme © iAndrew 2016 - Forum software by © MyBB