Hi, I was looking into building a search engine for displaying businesses. I wanted to use php to do this. Now i know how to do the initial coding website side and the setting up of an sql server and linking them together. My Query is when a customer does a search. Say for instance they do a search for (joe the plumber) and i have joe the plumber in the database, it will return what there looking for to whatever preference i set the code to display. But i also wanted the search to have another side to it. Which is This.. if they just searched for (plumbers) that it would pull all the plumbers up in a list as to how i want it to display it. So bottom line is that i want them to have either choice of finding what they want. Also i plan on laying it out as follows: Search ______________ County ______________ Town _______________ Search So whoever takes the time to read this and reply, i would appreciate it alot. Oh and one other thing i forgot to mention. If they make a spelling mistake is there a way of doing something to sort that too. Regards, Alan
You can place 2 additional columns in the table that holds the names of the people. The first column could indicate the type (doctor, engineer, plumber etc) by holding integers. The second column could be a sort order So if you want to query for all the doctors you scan the table with the condition of the specific type to represent the doctor. eg: select name from people where type=2 which will fetch the name from rows with that match type=2 To display the list depend how you want them to display for example in php: for($i=0, $j=count($rows); $i<$j; $i++ ) { echo '<div>' . $rows[$i] . '</div>' . "\n"; } where rows is an array that holds whatever you fetched from the database For the additional fields you wanted country, town etc you can have them in the form and when the form is processed you check these extra fields against the database and modify the query to something like: select name from people where type=2 and town=filter($_POST['town']) and country= filter($_POST['county']) of course you need to modify the syntax according to the database you use.