MySQL: Multiple Condition in WHERE clause

I know I’ve seen this asked before, but I can’t seem to find it. How do I put two different conditions within the WHERE clause in a MySQL query. For example, I tried this:

SELECT * FROM uicomments WHERE ID=$id AND type=$type

but I just got an error. Can anybody tell me how to do this properly?


try this:

SELECT * FROM uicomments WHERE ID='$id' AND type='$type'

LOL, I can’t believe I left out the quotes.

It works now, thanks joyce :slight_smile:


You don’t need quotes around numbers, just strings.