With this query: And when searching for one value

SELECT * FROM resources LEFT JOIN users ON users.id=resources.author_id LEFT JOIN categories ON categories.categories_id=resources.categories_id LEFT JOIN specialty ON specialty.specialty_id=resources.specialty_id WHERE categories.categories LIKE '%$_GET[categories]%' AND title LIKE '%$_POST[search]%' OR categories.categories LIKE '%$_GET[categories]%' AND description LIKE '%$_POST[search]%' OR ....... 

everything is fine, but if you search for more than one value, it does not find anything.

QUESTION: How to make so that when you request For example: WORD WORD everything was?)

  • Duck you have in the database is a combination of the слово слово with one space between them then? - teran
  • you break the search into an array, then with a loop you form LIKE , so that you get the title LIKE '%$splittedArray[0]%' OR title LIKE ''%$splittedArray[0]% .....' and insert it into the query - Alexey Shimansky
  • specify, you need to search for both words in the title / description, or at least one of them. - teran
  • it is necessary to find the author not only by the Name or Last Names, but also by the Last Name First Name, and in the DB, the full name is divided into separate pillars - As Lan
  • add to the query or 1=1 then everything will be - vp_arth

0