Welcome Guest, Not a member yet? Register   Sign In
Gas ORM 2.x

Hello everyone!

Does anyone know how i can do/use multiple find_by() ? 
In this case I want to find a users with specified role and where "account_status" != "blocked".

The code currently looks like the following snippet (Which is working perfectly)

PHP Code:
$data['users'] = Model\Users::find_by_role($role); 

But i only want users that aren't banned or blocked or whatever.
I can't exactly do the following.

PHP Code:
$data['users'] = Model\Users::find_by_role($role)->find_by_account_status($status);  /* wrong */ 

How can i find users with multiple WHERE clauses?

Any help would be greatly appreciated!

A Gas ORM model can take CI DB query bulder methods, so this should work:

PHP Code:
$data['users'] = Model\Users::where(array("role"=>$role"account_status"=>$status))->all(); 

See the very bottom of this page: http://gasorm-doc.taufanaditya.com/finder.html

Theme © iAndrew 2016 - Forum software by © MyBB