Welcome Guest, Not a member yet? Register   Sign In
Inserting user ID into session userdata
#1

[eluser]dmregister[/eluser]
I am trying to return the user ID into my userdata after a user logs in. I can store the username easily but I do not know how to get the id out of the db query without running it through a foreach.

The model selects all where $this->post->input(username) and $this->post->input(password). If affected row == 1, then it stores everything into an empty array called data. I can store the username by creating an array( username => $this->post->input(username)) and store this in the session.

The million dollar question is how to return the id from the sql in a form that I can store into the userdata of the session. if I try to insert it from the data array ($data['id'] or $data->idWink I get an error trying to access a non-object.

Thank you in advance for any advice.

Regards
-David
#2

[eluser]Mike DeFelice[/eluser]
Can you post your model? It would be much easier to see what is going on.




Theme © iAndrew 2016 - Forum software by © MyBB