The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.18 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search function
#11
Let me know how it goes.
  Reply
#12
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.
  Reply
#13
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)?
  Reply
#14
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
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

The Bob Smith thing is not important as the function would look in the username, first name and last name rows anyway...right?

  Reply
#15
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.
  Reply
#16
.
  Reply
#17
Any luck yet? Smile
  Reply
#18
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.
  Reply
#19
No worries mudmin. I'm very grateful that you are willing to take a crack at it.
  Reply
#20
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)
  Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)