The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

From Wikipedia, the free encyclopedia
In formal logic, De Morgan's laws are rules relating the logical operators "and" and "or" in terms of each other via negation, namely:
NOT (P OR Q) = (NOT P) AND (NOT Q)
NOT (P AND Q) = (NOT P) OR (NOT Q)

From Wikipedia, the free encyclopedia
In formal logic, De Morgan's laws are rules relating the logical operators "and" and "or" in terms of each other via negation, namely:
NOT (P OR Q) = (NOT P) AND (NOT Q)
NOT (P AND Q) = (NOT P) OR (NOT Q)

there are two cases: cat_id is a numeric column, or cat_id is a string column

(with values like 21 and 22, i already know which it is)

so if cat_id is a numeric column, you neither need the values in single quotes, nor should you have them (if you have them in any other database system, you get a syntax error, but mysql silently converts the strings to numbers)

on the other hand, if cat_id is a string column, you don't need the single quotes but you should have them (several database systems will silently convert numeric values to strings for the comparison)

I often quote as a defence mechanism. If your id value is coming in from a user request then it might contain malicious sql statements, for example terminating your sql statement and putting in a delete sql statement. Without quotes the delete is executed, with quotes it is just treated as an id value.