- Notifications
You must be signed in to change notification settings - Fork 286
Closed
Description
I know this is probably going to be very obvious, but can anyone please show me how to group my WHERE conditions when using the selecting function? I know how to write it in standard SQL, but I can't for the life of me work this out using ezSQL.
What I'm wanting
SELECT user_id, user_password, user_password_key FROM users WHERE (user_login = $userData OR user_email = $userData) AND user_status=1
What I've tried
$db->selecting('users', 'user_id, user_password, user_password_key', where(eq('user_status', '1', _AND)), where(eq('user_login', $userData, _OR ), eq('user_email', $userData ))); $db->selecting('users', 'user_id, user_password, user_password_key', where(eq('user_status', '1')), where(eq('user_login', $userData, _OR ), eq('user_email', $userData ))); $db->selecting('users', 'user_id, user_password, user_password_key', $db->where(eq('user_login', $userData, _OR ), eq('user_email', $userData )), $db->where('user_status', '1')); $db->selecting('users', 'user_id, user_password, user_password_key', eq('user_login', $userData, _OR ), eq('user_email', $userData ), $db->where('user_status', '1') ); It works if I remove the condition for the user_status, but when it's in there it just returns NULL.
Metadata
Metadata
Assignees
Labels
No labels