Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I cant figure out what's the right syntax for this:
PHP
this->db->where ('Username',$session_username);



I'm trying to use the value of the $session_username as a filter for mysql WHERE.
PHP
$session_username = $this->session->userdata('Username');


I was able to echo the $esssion_username inside the model where all this code belongs so I'm sure
it's not a variable type problem.

Thanks,
Posted
Comments
KatsuneShinsengumi 8-Apr-14 17:49pm    
I guess most of users here like me dont know codeigniter,...

1 solution

I got it now,

PHP
$session_username = $this->session->userdata('Username');
            $sql =  "SELECT UserID FROM  username_table WHERE Username = '$session_username'";
            $insertedUserID = $this->db->query($sql)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900