User session by filtering a field

It is possible to generate a session variable, in which I save the user’s session, together with another variable that belongs to the user table, which is a filter to display the data in a table according to the access of that user.Example:

table a: users: id, username, pass, deposit_id
table b: deposit: deposit_id, nameIf the user has 2 or 3 deposits to access, I want him to only show those deposits in a third remitos table.
Is this possible? Thanks for the help. Cheers

ddiaz2380 wrote:

I want him to only show those deposits in a third remitos table.

Then please post that third remitos table schema for more discussion.

You can use the User_Validated server event to save the session value, and use the session value as the table filter.

mobhar wrote:

ddiaz2380 wrote:

I want him to only show those deposits in a third remitos table.

Then please post that third remitos table schema for more discussion.

table a: users: id, username, pass, deposit_id
table b: deposit: deposit_id, name
table c: id, product_id, deposit_iddeposit_id is multiple, they can be 1 or more, I need at the beginning of the session, the variable is saved and according to the deposits that the user has, when displaying the lookup of table c in deposits, only have the deposits assigned to it in table a in the deposit_id field.
My English is bad, I hope I was clear.

arbei wrote:

You can use the User_Validated server event to save the session value, and
use the session value as the table filter.

For there is the only way that I do not find in the documentation how to do it.
I thought it could be easier. As in the beginning of the user session:
$ _SESSION [‘iduser’] = $ data [‘ID’]; // Id user
$ _SESSION [‘deposits’] = $ data [‘deposit_id’]; // Deposits to which you are authorizedThen in the table I need the filter:
$ deposit_id = $ _SESSION [‘deposits’];
$ query-> addWhere (“deposit_id IN ($ deposit_id)”); // You can only access your deposit informationBut I did not find anything in the documentation, sorry if they are very new queries but I am just starting with the tool. I come from using django and python which is a little simpler than php.

ddiaz2380 wrote:

$ deposit_id = $ _SESSION [‘deposits’];
$ query-> addWhere (“deposit_id IN ($ deposit_id)”); // You can only


  1. Make sure $deposit_id has value before using it. (If the user is logged in yet, there is no $_SESSION [‘deposits’].
  2. Note that you have extra spaces in your code.
  3. $query->addWhere() does not look like PHPMaker code, make sure it is correct. Where did you add your code?