In which case, you need to use the Auth component as you say. As tangerine notes my code was just an example of how you can use where() to apply a WHERE condition to the queries Editor performs. I don't know the inner workings of your software and where the user id actually is. You would use that variable, whatever it might be, in the where() statement.
Replies
Are you using the PHP libraries for Editor? If so I would recommend using the
where()
method - something like:For example might do the trick.
Docs for
where()
.Allan
i tried using the where as shown below, and it gives me what im looking for but not sure how to get the id of the logged in user.
->where($key = "employer_id", $value = 77, $op = "=")
when i try your way, it says "invalid json response".
i am using php libraries for Editor.
Send only the values to where() :
->where( "employer_id", 77, "=")
That was just a test case and it worked but the i want the data with the same id as the logged in user id to be displayed.
So how are you saving logged-in user id's? Allan assumed you were saving them to the session.
The application is built using cakephp so to get the user id i could just use the Auth component but i am not saving a php session.
In which case, you need to use the Auth component as you say. As tangerine notes my code was just an example of how you can use
where()
to apply a WHERE condition to the queries Editor performs. I don't know the inner workings of your software and where the user id actually is. You would use that variable, whatever it might be, in thewhere()
statement.Allan
ok thanks.