The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Search function - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: General (https://userspice.com/forums/forumdisplay.php?fid=20) +--- Forum: UserSpice 5 - Roadmapping the Future (https://userspice.com/forums/forumdisplay.php?fid=31) +--- Thread: Search function (/showthread.php?tid=142) Pages:
1
2
|
Search function - mudmin - 06-02-2016 Let me know how it goes. Search function - LBC - 06-08-2016 Hello Mudmin, I'm sorry to say I cannot seem to get it to work. I'm just not cut out for coding stuff from scratch. I can work with existing code, altering it, adding to it. But not writing it... So, I will just hope for this feature to be implemented in a future update as I do love UserSpice. But untill then, I will look for other platforms to work with. Search function - mudmin - 06-08-2016 I may take a crack at it this weekend. I need to confirm what you want to search though. You want to be able to search the users table, right? What fields do you want to come up (obviously not password, etc). The other thing is... if someone's name is Bob Smith, do you want them to specify whether they're searching for someone with the first name of Bob or just to see if Bob is anywhere in the user table (usernames, last names, email addresses, etc)? Search function - LBC - 06-09-2016 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 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 The Bob Smith thing is not important as the function would look in the username, first name and last name rows anyway...right? Search function - mudmin - 06-09-2016 Right...Ok. I just had to wrap my mind around what the end goal was so I didn't go off in the wrong direction. I'll try to take a crack at it Saturday. Search function - LBC - 06-14-2016 . Search function - LBC - 06-14-2016 Any luck yet? Search function - mudmin - 06-14-2016 I haven't gotten to it. I'm really sorry. I'm usually pretty good at doing stuff when I say I will, but I had a pretty rough weekend. I haven't given up on it. I'm going to shoot for late Friday. Search function - LBC - 06-15-2016 No worries mudmin. I'm very grateful that you are willing to take a crack at it. Search function - mudmin - 06-18-2016 I wrote a search function example that searches first and last names, but it's really easy to add more values to search, you just expand the query. I designed it to run in the users folder and be called search.php Just so it is available to everyone else, I'm storing it at this link as search.txt Here is the link to the search.php file (don't forget to rename it to search.php) |