⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Login with multiple users to access db



Ray
  • profile picture
  • Member

Posted 19 January 2016 - 19:27 PM

I am planning to make a book management system with grocery crud and a login system

 

Each users have their own list of book 

 

The system has many users, and a new user can register an account to use the system

 

How do i make the system with grocery crud where, each users view their own list of books

 

which they have stored ?

 

do i need a new table for each user

 

Sorry if hard to understand, newbie 

 

Thank you


Amit Shah
  • profile picture
  • Member

Posted 19 January 2016 - 22:15 PM

Hi,

 

nope, you dont have to have a seperate table for each user - rather you just need to restrict with 

$crud->where('user_id', $loggedinuserid)

 

well.. there are many such things you can do to restrict - u can check the record thats getting edited / viewd. Check if that records userid dose not match with the 1 logged in - boom - throw him an error - else show him

 

You can check out getState / getStateInfo for what state the user is trying to access a specific record ... 

 

Happy GCing :)


Ray
  • profile picture
  • Member

Posted 31 January 2016 - 08:27 AM

Ok thanks,

 

Im now trying to integrate GC with ion_auth

 

Now users can register and login.

 

How do i make the record to automatically set the user_id field in the db to the provided user_id when the user

 

adds a new record.

 

is there a set value function in GC

 

Thank you