Welcome Guest, Not a member yet? Register   Sign In
Quick datamapper query question
#1

[eluser]Andy78[/eluser]
I want to get all users that have a user_type_id of 1 or 2 and their user_status does not equal 'deleted'.

Currently I have:

Code:
$admin_users = new User();
        $admin_users->where('user_status !=', 'deleted');
        $admin_users->where('user_type_id', 1);
        $admin_users->or_where('user_type_id', 2);
        $admin_users->include_related('user_type', array('user_type'), TRUE, TRUE);

This is returning all users where user_status != 'deleted' AND where user_type_id = 1 OR where user_type_id = 2.


Which clearly is not correct because any user with an user_type_id of 2 is returned.

How do I perform this query correctly in datamapper?


Messages In This Thread
Quick datamapper query question - by El Forum - 03-22-2012, 10:27 AM
Quick datamapper query question - by El Forum - 03-22-2012, 10:44 AM
Quick datamapper query question - by El Forum - 03-23-2012, 02:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB