06-09-2016, 07:08 AM
Hey Mudmin, thanks!
I indeed need to be able to search the users table. In that table I have added "country", "community", "area" and "interest1", "interest2", "interest3", "interest4", "interest5", "interest6", "interest7", "interest8", "interest9", "interest10".
The "interest1-10" are filled by checkboxes in the signup form. I read somewhere that its better to have stuff like that seperated in individual rows making the search easier...or something![Tongue Tongue](https://userspice.com/forums/images/smilies/tongue.png)
An interest could be "nature" or "people" or "animals" or "children", etc.
So the search function needs to be able to search in users and look for username, first name, last name, country, community, area and/or insterest1-10. It should not be an exact match otherwise someone who misspells a country name wouldnt find anything.
Something like:
No idea if that code is correct though![Tongue Tongue](https://userspice.com/forums/images/smilies/tongue.png)
The Bob Smith thing is not important as the function would look in the username, first name and last name rows anyway...right?
I indeed need to be able to search the users table. In that table I have added "country", "community", "area" and "interest1", "interest2", "interest3", "interest4", "interest5", "interest6", "interest7", "interest8", "interest9", "interest10".
The "interest1-10" are filled by checkboxes in the signup form. I read somewhere that its better to have stuff like that seperated in individual rows making the search easier...or something
![Tongue Tongue](https://userspice.com/forums/images/smilies/tongue.png)
An interest could be "nature" or "people" or "animals" or "children", etc.
So the search function needs to be able to search in users and look for username, first name, last name, country, community, area and/or insterest1-10. It should not be an exact match otherwise someone who misspells a country name wouldnt find anything.
Something like:
Code:
"SELECT * FROM users WHERE country LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR area LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR community LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR username LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' fname LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR lname LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}' OR interest1 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest2 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest3 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest4 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest5 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest6 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest7 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest8 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest9 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}', OR interest10 LIKE '{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}{$query}{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d}'order by user_id")
No idea if that code is correct though
![Tongue Tongue](https://userspice.com/forums/images/smilies/tongue.png)
The Bob Smith thing is not important as the function would look in the username, first name and last name rows anyway...right?