Hi, I have developed a website with a user profile page with eye_colour , hair_colour , size etc. Each item has a set range of values entered through a drop down list. I wish to allow the users to search these set range’s to find their ideal match.
To this end I have a search form set up and a number of SELECT statements feeding to arrays each using the tuple user. i.e.
$var1 = SELECT ‘user’ FROM ‘profile’ WHERE ‘hair_colour’ = $hair;
$var2 = SELECT ‘user’ FROM ‘profile’ WHERE ‘eye_colour’ = $eye;
$var3………4………..5………..n etc.
I think there is a function which allows all the arrays to be taken in and unioned ALL together, then sorted/weighted by the most occurances of the user and all items can then be displayed. Does anyone know if such a php function exists and if it does what its name is? I could try the SQL if such a function doesn’t exist but I’d definitely make a few mistakes!! Thanks for any help!

P.S. Its important to display the most suitable results for the user but its also important to display some results if they meet any requirement so that it doesn't continually display no suitable results therefore I would prefer a weighted system rather than an intersect system.


try reading about the php range function here. This will allow you to define the start and the limit of the array being evaluated.