i made a search user system in which user’s are searched by their first name or email but the problem is if i enter the full name of the user it does not search it and also i am not able to make a query for that . i used this query to get user from first name and email.
"select * from users_profile where fname like '%$q%' or Email like '%$q%' order by rand() LIMIT 10"
but how to get users from both first and second name . suppose i enter "john" it gives out the full result such as john doe but if i enter the full name such as john doe it does not gives any result. in my database the first name is represented by fname and last name by lname. ny help with this?
You can use mysql CONCAT function to concatenate both first and second name and then search on the result, like this:
that should do what you want.