sembrerebbe che l'errore sia nella query che hai eseguito in precedenza, prova con:

Codice PHP:
mysql_query($query) or die(mysql_error()) 
Oppure fatti stampare la query ed eseguila in phpmyadmin o nella shell di mysql...