Answer the question
In order to leave comments, you need to log in
Search from two columns from one value?
There are 3 columns in the database product , artikul, cats
In the input, the user can enter either an article that consists of an example: AL89T or the name of the product: Woody Woodpecker. cats 110 is a toy archive category.
I need, depending on what the user has entered into IPnut, to do a search in the database by products and articles and not take into account the archive of toys
SELECT * FROM toys_products WHERE product LIKE '%" . $_GET['prodect_like'] . "%' OR artikul LIKE '%" . $_GET['prodect_like'] . "%' AND cats NOT LIKE '%x110x%'"
Answer the question
In order to leave comments, you need to log in
For the concatenation of SQL and Get parameters, hit yourself on the fingers.
You need to write a query using 2 variables. Something like
SELECT something from table1
WHERE (@param1 IS NULL OR @param1 = col1) OR(@param2 IS NULL OR @param2 = col2)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question