Forums
This topic is locked
multi-word searches
Posted 09 Jun 2002 23:05:09
1
has voted
09 Jun 2002 23:05:09 Andrew Ross posted:
I have a database driven site that is currently using Access and I have to convert it to MySQL. I have been able to convert my basic search page, but I'm stuck on my keyword search page and I'm hoping someone can give me some advice.The current Access page is based on Tom Steeper's Advanced Search Tutorial. members.prestige.net/ultradev/advanced_search.htm I use this to search an Access query that combines the First_Name, Last_Name, Company, City and Notes columns from my Contacts table into one column called CombinedFields. Users can search by keywords and choose AND, OR or EXACT PHRASE comparators.
Now I need to recreate this page for MySQL which doesn't support queries. I tried using Tom's latest tutorial, which searches more than one column, but I can't get it to work with my recordset because it retrieves data from more than one table. The recordset is below and I want to be able to do keyword search like I did with Access. Can anyone help please?
<pre id=code><font face=courier size=2 id=code>SELECT Categories.Category, Contacts.First_Name,
Contacts.Last_Name, Contacts.Company, Contacts.Address_1,
Contacts.Address_2, Contacts.City, Provinces.Province,
Contacts.Postcode, Contacts.Fax, Contacts.Phone,
Contacts.Email_Address, Contacts.WebSite, Contacts.Notes,
Contacts.Notes2, Contacts.Notes3, Contacts.Image2,
Contacts.Image3, Contacts.Detail, Contacts.Photo
FROM ContactCategories, Contacts, Categories, Provinces, NearMajorCity
WHERE ContactCategories.Contact_ID = Contacts.Contact_ID
AND ContactCategories.Category_ID = Categories.Category_ID
AND Provinces.Province_ID = Contacts.Province_ID
AND NearMajorCity.NearMajorCity_ID = Contacts.NearMajorCity_ID
ORDER BY Category, Last_Name, Company</font id=code></pre id=code>