I'm looking to create a basic search function - someone can put in a phone number, and it will come up with any contact(s) that have the phone number assigned. This works, however, I (for obvious reasons) only want users to be able to search their own contacts, not that of others.
Code: Select all
SELECT * FROM contacts WHERE c_tel_home='$keyword' OR c_tel_work='$keyword' OR c_mob_home='$keyword' OR c_mob_work='$keyword' AND u_id='$Userid'This doesn't happen if I only use:
Code: Select all
SELECT * FROM contacts WHERE c_tel_home='$keyword' AND u_id='$Userid'Is there a way to make my first select statement work like this?
Any pointers would be appreciated.