I have a MySQL users table with multiple fields including interger user type field (admin or normal). I am looking to have a master search which can search given string in all fields but with a where clause of user type (for a specific type)
I am using
$sql = "SELECT * FROM users WHERE user_fname like '%".$data."%' OR user_lname like '%".$data."%' OR user_login like '%".$data."%' OR user_callsign like '%".$data."%' AND user_type='2'";
But When I search, it query the whole table neglecting my user_type clause. I am running out of ideas, please suggest me how would I over come this.
Thanks,