I have one simple users table and I want to find all users where email_notifications = 1.
Logic dictates that the following should work:
class Controller_Test extends Controller { public function action_index() { $user = ORM::factory('user'); $user = $user->where('email_notifications', '=', 1); $total = $user->count_all(); $users = $user->find_all(); echo $total." records found.<br/>"; foreach ($users as $v) { echo $v->id; echo $v->first_name; echo $v->last_name; echo $v->email; } } }
However, what happens, I am returning ALL of my users from the database, and not just those with email_notifications enabled. The funny thing is that the return value of $total is the exact result number of this query.
I'm so stupid, I have no idea what the problem is. If anyone could shed some light, I would really appreciate it.
Thanks,
Brian
source share