I have MySQL table that is used to collect letter data by the subject_id, joined with tbl_user table. tbl_user as follows :
+--------+------------+----------+
| userID | subject_id | username |
+--------+------------+----------+
| 1 | 100 | user1 |
| 2 | 101 | user2 |
| 3 | null | user3 |
| 4 | 102 | user4 |
+--------+------------+----------+
In my controller, I used the following code to filter records by subject_id.
$subject = $this->session->userdata('subject_id');
if ($subject && $subject != null )
$this->datatables->where('letter_letter.subject', $subject);
This is working perfectly. In the other words, letter records filtering by subject_id fine. But I want to list all the records in the letter_letter table for user, "user3" in the session.
How can I modify my code to do this ?. Can anyone help me ?