L
L
LordPrimes2018-03-25 17:36:05
MySQL
LordPrimes, 2018-03-25 17:36:05

What's wrong with SQL AND?

Good afternoon. I made a selection by category, where everything works, I decided to finalize it, and add AND

$query = "SELECT * FROM products WHERE brand =  '".$_POST["category"]."' AND 'MSI' ";

But for some reason, the selection by category is no longer displayed. I don’t understand where the error could be. If it’s not difficult for someone to tell me what’s wrong. If you remove AND and everything after it, everything works.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2018-03-25
@Arik

1. What is "AND 'MSI'" ? brand can be MSI?
2. If so, why AND? maybe OR is better? Or transferred partition OR MSI?
3. You need to explicitly specify the field every time
(`brand` = '$brand' OR `brand` = 'MSI')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question