The product is searched by name. How to make it so that it is searched not only by the title "title" but also by the product name "products_id"?

$count = mysql_query("SELECT COUNT(*) FROM table_products WHERE title LIKE '%$search%' AND visible = '1'",$link); $result = mysql_query("SELECT * FROM table_products WHERE title LIKE '%$search%' AND visible='1' ORDER BY $sorting $qury_start_num ",$link); 

  • What does "but also by Id" mean? you need to match both conditions or at least one of them. is there any priority in the search / issue. But in general, you just need to add another condition to the sql query in the where part - Mike
  • To match both conditions. That is, so that you can search in search and by name and by ID - Roman Shelest
  • If both means use 'AND' in the condition. - Mike
  • @Mike Tried WHERE title and products_id - does not work - Roman Shelest
  • You would see a couple of examples of queries, for example, here oracleplsql.ru/where.html AND, as in any other programming language, is a logical operator, to the left and right of which full conditions are set. And the condition is a comparison of two values ​​i. consists of at least 3 components: "what we compare", "comparison operator", "what we compare with" - Mike

0