Dysan
12-26-2007, 04:56 PM
How do I create a search engine, that allows the user to search 3 different fields contained in the database, with a specified criteria?
|
Click to See Complete Forum and Search --> : Simple Search Engine Dysan 12-26-2007, 04:56 PM How do I create a search engine, that allows the user to search 3 different fields contained in the database, with a specified criteria? SyCo 12-26-2007, 06:05 PM It would help to know what that criteria is. All I know so far is you want it simple so here goes. Create a form with 3 inputs and submit it to a page that looks in the table using a query like. select * from table where field="$_POST['var1']" OR field="$_POST['var2']" OR field="$_POST['var3']" by 'field' do you mean table column or form inputs? Are you looking for a simgle form input in 3 colums, 3 inputs in 3 columns or a different combination. Dysan 12-26-2007, 07:49 PM yes, "field" means column. if the user enters a keyword "th" for example, the results display should be everything containing the phrase "th. SyCo 12-27-2007, 09:51 AM Dysan, you're still not being very clear as to what you want. If you need help you need to be specific and preferabley break your questions into small parts to make them easier to answer. You can't be ambiguous with programming. by 'field' do you mean table column or form inputs? Are you looking for a simgle form input in 3 colums, 3 inputs in 3 columns or a different combination. The combination is important, my first post searched 3 terms on one column, I'm now presuming a single serch term and 3 columns to search, is that correct? You didn't answer my question so that doesn't inspire me to assist you. I'm not obliged to help, like everyone else here so if someoone asks for info and you dont provide it why would we continue, when theres loads of forums and people asking questions. Anyway... What do you ean by search for 'th'? Is that a search that will hit on 'the' and 'booth' and 'slither' or just 'th'. The % is a wild card so you can ammend the first query to select * from table where col1 like '%$var%' or col2 like '%$var%' or col3 like '%$var%' That would return 'the', 'booth' and 'slither' in any of the 3 cols searched for a single search term. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |