I am having trouble with MySQL in CodeIgniter, I have the 3 columns:
ID | USERID | NAME | MOBILE 1 1 JAMES 55 2 1 JOHN 66 3 2 ANNE 33
I want to count the number of rows where the USERID is 1 in CodeIgniter, anyone can help me?
I expect the output will be 2, because there is 2 records assigned to the USERID 1.
Thanks
$this->db->where('USERID',1);
$this->db->from('my_table');
echo $this->db->count_all_results();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With