-2

I need help in issue related to MySQL database OR Operator, I am new to MySQL database so I am facing problems. Actually, I am building search engine filter. I am getting two values from another page and show them on a search page by filtering from the database. Here I declare values that come from another page

$cid = $_GET['cid'];
$plateform = $_GET['plateform'];

And here is my SQL

SELECT * FROM `products` WHERE (Cat_id = $cid) OR (plateform_id IN ($plateform)

when I try to get two values it gives me error like and when I get one value it works well. help me solve this problem. It gives me an error , given below

mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
Nigel Ren
  • 56,122
  • 11
  • 43
  • 55

1 Answers1

1
you are missed close parenthesis at the end.

Need to change:

SELECT * FROM `products` WHERE (Cat_id = $cid) OR (plateform_id IN ($plateform)

To:

SELECT * FROM `products` WHERE (Cat_id = $cid) OR (plateform_id IN ($plateform))

Or you can also modify your query.

SELECT * FROM `products` WHERE Cat_id = $cid OR plateform_id IN ($plateform)
Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51