print out the query string you are trying to execute. If you can't see any obvious errors, throw the query into something like phpMyAdmin which should be able to give you more specific error information. Basically this means that it's your SQL code that is at fault, not the PHP. The problem could be caused by a mis-type or a logic error in your PHP (which is different from a syntax error)