I need a better mySQL query for my [url removed, login to view] file on my website.
Here is the current one:
$q = mysql_query("SELECT * FROM files WHERE ([url removed, login to view] LIKE '%".$term."%' OR [url removed, login to view] LIKE '%".$term."%' OR [url removed, login to view] LIKE '%".$term."%') AND [url removed, login to view] = 1");
The problem with this is that if the search term is "blue jeans" then it will only select items from the database that have "blue jeans" together as one term in either the title,description or tags fields.
Also if the term "jeans blue" rather than "blue jeans" is in either one of these fields it will not select the item.
So, I need a query that will select the item if the word "blue" is in one field and "jeans" is in another. And also if the term "blue jeans" is used but it is "jeans blue" in the field. Or an item with "blue apparrel clothes jeans" would also come up with a search of "blue jeans."
A one word search such as "jeans" should also result in any item with that word in any of these three fields.
Also it would be great if the words "or" and "and" were stripped from the search if they were used.
If you can do it I would send you the whole [url removed, login to view] file to fix up and any other files you needed.