Posta l'esatto messagio di errore che ottieni, e prova ad usare un codice più "corretto":
Codice PHP:
function query($query) {
$q = @mysql_query($query, $conn); // $conn da dove viene?
if ($q === FALSE) {
throw new Exception(sprintf('DB::query | errore mysql(%s): %s', mysql_errno() , mysql_error()));
}
return $q;
}