• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to show data only his data while he login

#1
Hi everyone, 
The condition is employee login by using email as username, and after login all employess data are shown in the table. But the condition  i want is this: when an employee login, he only could see his data only.

The condition now is :

    $this->datatables->select('id_users,full_name,email,address,images,salary');
   $this->datatables->from('tbl_user');

It will show up all data,,so i modified it by adding this line


    $this->datatables->select('id_users,full_name,email,address,images,salary');
   $this->datatables->from('tbl_user');
   $this->datatables->where('email=".$this->session->email."');
But no data shown up in the table, how to fix this? 

I am sorry , i already google but still confuse, i think this is about getting record by session, any help will be very usefull since  i am a beginner, thanks.
Reply

#2
If you are using the query builder, the syntax for the where method is like this:

PHP Code:
$this->datatables->where('email'$this->session->email); 
Reply

#3
I'm curious, what is the object $this->datatables? An alias for the usual $this->db? Or is it some custom class?
Reply

#4
(02-16-2018, 01:53 PM)Wouter60 Wrote: If you are using the query builder, the syntax for the where method is like this:

PHP Code:
$this->datatables->where('email'$this->session->email); 

Thank you very much, it works very well  Smile
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.