I wish I had £1 for every time this question gets posted. If you check the documentation for
PHP: mysql_query - Manual[
^] you will clearly see that when the query statement fails the call returns the boolean value FALSE. Do not assume that your API calls always do what you think; check the return values first.