Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Search query for advance search of Matrimonial website (http://www.go4expert.com/forums/search-query-advance-search-matrimonial-t26962/)

tinyprogram 19Oct2011 10:15

Search query for advance search of Matrimonial website
 
Hi...

I am getting trouble in writing a query for multiple selection in a Matrimonial website..

e.g. If someone searches for a groom with religion as Hindu or Muslim, caste as Kayastha, Shudra, Vaishya or Kshtriya and profession as Engineer or Manager, then how to write query for it?
I am taking input from listbox...with multiple selection...l

Thanks in advance :)

shabbir 19Oct2011 10:17

Re: Search query for advance search of Matrimonial website
 
Use the IN operator in the query.

Religion in ('Hindu', 'Muslim') AND/OR Caste in ('Kayastha','Kshtriya')

tinyprogram 19Oct2011 10:19

Re: Search query for advance search of Matrimonial website
 
shabbir...thanks for your reply...

but there are 'n' numbers of options and suppose the user opts for 'm' number of options, then how to write query?

shabbir 19Oct2011 11:39

Re: Search query for advance search of Matrimonial website
 
It does not matter how many options user selects and you can add each of them in the IN query.

tinyprogram 19Oct2011 12:35

Re: Search query for advance search of Matrimonial website
 
ok...but I don't know that how many options that user will select at runtime...may be he can select 5 options out of 10, 10 out of 10 or any other number...

My question is how to run query when I am not sure about the number of options the user had selected.

thevikasonline 15Nov2011 00:25

Re: Search query for advance search of Matrimonial website
 
Make a separate search table which form indexes with others related tables. Fire your query direct to this table and make join with others table by the help of result you get from this.

jhonden 15Nov2011 12:32

Re: Search query for advance search of Matrimonial website
 
Do colone search for exact and prompt search.


All times are GMT +5.5. The time now is 19:04.