I am learning coding, but I am wanting to make an interactive roster for a local youth camp where upon registering a new camper's personal information (in database is 'name', 'birth_year', 'hobbies', 'favorite_subject', 'spirit_animal_explanation' and 'contact_information') the camper can select a "group-me" button that will display the profiles of other campers who have similar hobbies and spirit animals as them as well as being within the same age group (11-13yrs, 14-16yrs,etc).
To achieve this, when a camper enters in his/her information, it is first saved into the database. I then query a SELECT syntax that takes the info from the 'hobbies' and 'spirit_animal_explanation' columns of the camper and filter it of unwanted words and put them in an array (so for 'hobbies' if the camper says "I like Running and Jumping" the the filter will array will only print_r Array([0]=>running[1]=>jumping).
I then array_merge the two filtered arrays into one so I easily manage the search (some campers like mixing up the hobbies into the spirit_animal_explanation so by having a single reference array for both columns the search can be easier) leaving me with a $compiled variable containing the two merged arrays.
Now the part(s) I am Struggling with: I am able to prepare the reference array for the search, but I don't know the query syntax to begin the search or scanning the 'hobbies' and 'spirit_animal_explanation' columns of every user using the reference array. From previous suggestions I've read up on JOIN queries but I don't see a point in making two tables because the elements of the reference array are not fixed/constant for every camper that executes the search. Also, I have no idea how/when I should add in the age conditional. Finally, the improve latency I want the system to look for the first 10 matching users on the first search session, then the next ten users on the second, etc. How can I go about doing this?
Aucun commentaire:
Enregistrer un commentaire