what is wrong with this sql query. i cant figure it out.
$query = "SELECT *
FROM tagPairs
WHERE (tag1Id IN ($tag1Id, $tag2Id))
AND (tag2Id IN ($tag1Id, $tag2Id))";
error code:
Couldn't execute query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' )) AND (tag2Id IN (, ))' at line 3
thanks in advance!
$tag1Id
and $tag2Id
are both null, or empty strings. The simplest solutions is probably to explicitly cast them into numerical values:
$tag1Id = intval($tag1Id); $tag2Id = intval($tag2Id); $query = "SELECT * FROM tagPairs WHERE (tag1Id IN ($tag1Id, $tag2Id)) AND (tag2Id IN ($tag1Id, $tag2Id))";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With