Welcome Guest, Not a member yet? Register   Sign In
queries for a new user
#1

[eluser]Mantra of Doom[/eluser]
I am new to codeigniter and php and I'm in the middle of developing my first application.

So far, I can Create users, log them in and sign them out.

Using sessions, I even set up a greeting that calls the username and puts it on the profile page.

The part that I get stumped at is, I want to display a user's email address and other information that was entered on user creation and display it so that it shows only that user's data.

I know I need to do a query, but I'm not sure how to write it.
I need to get the username and email_address from a table called 'player', which holds the user data, and then allow the user to edit this info. If anyone can point me in the right direction, that would be great. I just can't wrap my head around queries right now.

Thanks in advance!
#2

[eluser]nelson.wells[/eluser]
This is more of a SQL problem than a CI one. Take a look at Tizag or W3School's tutorials about SQL, those are the 2 sites that helped me the most when I was refreshing myself from my DB classes. Anyway, the CI / Active Record way to do that query would be something like

Code:
$this->db->select("username, email_address");
$this->db->where("id", $user_id);
$query = $this->db->get("player");
$row = $query->row();
echo $row->username . " is the username and " . $row->email_address . " is the email address.";




Theme © iAndrew 2016 - Forum software by © MyBB