I have a code that is supposed to SELECT items from a table where the fields color_base1 and color_base2 are similar to specific colors.
However, currently my code is just returning all the fields in my table, kind of ignoring the LIKE I am applying:
$result3 = $con -> prepare("SELECT * FROM item_descr WHERE (color_base1 LIKE CONCAT ('%', ? , '%') OR color_base2 LIKE CONCAT ('%', ? , '%')) AND id_item != $itemId LIMIT 4");
$result3 -> execute(array("$color_base1", "$color_base2"));
$row3 = $result3->fetch();
Would anyone have any input on how the SQL is built and how I should build it?