This topic is locked

Where clause for logged user

1/11/2012 12:02:04 AM
PHPRunner General questions
L
loserkids04 author

Hi,

I have two tables tab1 and tab2. The tab1 has a FK to tab2.

When a User logging in, I would like to show only the data for that User, through this FK which is actually the user_id (tab2 is the table of users)
Something like

"user_id = '". $ _SESSION [' UserID ']. "'"

.In the WHERE clause of the 'lookup' and thus show only the data that belongs to this User ID.
I hope you understand me.
Thank you.

Sergey Kornilov admin 1/11/2012

Could you clarify what's wrong with WHERE clause below? It looks like it would do the job.

"user_id = '". $_SESSION['UserID']. "'"
L
loserkids04 author 1/11/2012



Could you clarify what's wrong with WHERE clause below? It looks like it would do the job.

"user_id = '". $_SESSION['UserID']. "'"



It's not working.
No data appears when I type something belonging to the logged in User.
The user_id is a FK in the first table whose values I want to enable. AND user_id is the PK in the second table wich is the users table.
Is there any way to link this 2 tables and make this 'lookup' ? The user_id is a INTEGER value.

Sergey Kornilov admin 1/11/2012

$_SESSION['UserID'] is a textual value of logged user username.
Use AfterSuccessfulLogin event to save ID from login table in another session variable and then apply that session variable to your WHERE clause.
More info:

http://xlinesoft.com/phprunner/docs/after_successful_login.htm