Select one row in MySQL with both AND, OR statements
Posted: 27 Nov 2014, 07:42
Hello,
I have this Select query, I want to select one row from mysql table, where id = $id, and has "x_name" or "y_name" 'yes'.
But it returns more rows.
I don't know what is wrong in this query.
I have this Select query, I want to select one row from mysql table, where id = $id, and has "x_name" or "y_name" 'yes'.
Code: Select all
$insert_cat = $mysqli->query("SELECT * FROM `prod_site` WHERE id = $id AND x_name = 'yes' OR y_name = 'yes'");
I don't know what is wrong in this query.