Complex searches of MySQL with PHP

wxdqz

New Member
I was wondering if anyone could help me with this since it seems to be a little more complicated than a simple search.

I have two fields - Title and Author in my MySQL table that I want to be able to search through (i have many more fields that I will want to bring back to display of course).

I currently have a simple LIKE %$keyword% search working ok but I want to be able to type in something like Lion Horses in the Title field on the HTML form with the option of searching the entire Title field for either word appearing (I would also like the option of being able to say All Words as well in addition to Any Words which would mean that BOTH Horses and Lion must appear in the Title but not necessariliy in the order typed in on the form field).

I am hoping that the users could do something also like Horses + Lion - Tigers (just like a normal search engine) in the form field as well but that would likely be QUITE complicated.

In addition, if the user types something like "Lion Horses" in the HTML form for Title, it would mean that an exact match was required inside of the Title field in the MySQL db.

Maybe I could have a drop down box next to each field on the form with the option of Any Words, All Words and Exact Match but not sure of exactly how to use them.

Of course, I want this same functionality for the Author(s) field and any other fields I might want to add searchable later to allow complex searches.

Here are the numbers of my server as far as versions show:
MySQL 3.22.25-log running on localhost
phpMyAdmin 2.0.1

I have found some code on this site but not exactly matching what I am asking here so any assistance would be of GREAT help!

Thanks in advance!
Brian
 
Back
Top