Welcome Guest, Not a member yet? Register   Sign In
Getting data from session syntax problem.
#1

[eluser]Katsune[/eluser]
[EDITED]
Hi,

I cant figure out what's the right syntax for this:

Code:
[$session_username = $this->session->userdata('Username');
        $sql =  "SELECT UserID FROM  username_table WHERE Username = '$session_username'";
        $insertedUserID = $this->db->query($sql);
        $shit = $insertedUserID->result_array();
        print_r ($shit);

Whenever I run this the result is:

Code:
Array ( [0] => Array ( [UserID] => 1 ) )

But what I only need is the value 1 from the UserID column. How can I get that?

Can anyone tell me how to write the right syntax for the first code above?

Thanks,
#2

[eluser]Katsune[/eluser]
Hi,

I got it now, I need to rely in our good old but effective loop.

Thanks,




Theme © iAndrew 2016 - Forum software by © MyBB