Hi All,
This has been discussed a bit before, but I am trying to write a search/SELECT query for a database query. I am using full-text for this (php and mysql).
I have a number of input boxes that I am trying to combine into one select statement, but it is not working. The issue is that not all inputs will need to be filled in and my form includes a date range search option.
Here is the html form I am using - I have a number of drop-downs but these aren't causing any problems:
So far my SELECT query works but it does not work if I use only one keyword. Also, I do not know how to make a date range query.HTML Code:<input type="text"> <select name="drop1"> <option value="A">A</option> <option value="B">B</option> <option value="C">B</option> </select> <select name="operator"> <option value="and">and</option> <option value="or">or</option> <option value="not">not</option> </select> <input type="text"> <select name="drop2"> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> </select> //select year from:<input type="text"> to:<input type="text">
Here it is:
My question: can you point me in the right direction or refer me to readings for this? Do I need to you an 'else' somewhere in here?Code:"SELECT * FROM table_name WHERE MATCH(column_name) AGAINST('keyword1*' IN BOOLEAN MODE) AND MATCH(column_name) AGAINST('keyword2*' IN BOOLEAN MODE)");
Thanks in advance!





Bookmarks