CodeIgniter Forums
Display Record - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Display Record (/showthread.php?tid=244)



Display Record - jaysondotp - 11-13-2014

Hi coders,



how to display record where user is equal to session user. i have code below that i don't know exactly the syntax.

PHP Code:
$this->db->where('users.fname',$this->session->userdata('fname')); 

code above is not work as what i need.

please any help.


RE: Display Record - bobykurniawan - 11-13-2014

have you save the session before? (set_userdata)


RE: Display Record - sv3tli0 - 11-13-2014

Did you check database and session user guides?
there is everything you need..


RE: Display Record - slax0r - 11-14-2014

You do know that ->where() only sets the WHERE statement, and does not execute the query. I think you are looking for ->get_where().
After the query has run, you can display the query ran with $this->db->last_query() which returns the last ran query.


RE: Display Record - jaysondotp - 11-14-2014

Okay.. thanks all you guys,

i got the solution here:
PHP Code:
$this->db->where('users.fname',$this->session->userdata['logged_in']['fname']); 



RE: Display Record - Chroma - 11-14-2014

Thank you for the feedback and your solution.

Smile