A mi me anda sin problemas...
te cpaso el ejemplo q usé yo y me anduvo
Código PHP:
<?
function gestor($error){
echo str_replace("a","",$error);
}
mysql_query("select ...") or die(gestor(mysql_error()));
?>
La respuestas fue "You hve n error in your SQL syntx; check the mnul tht corresponds to your MySQL server version for the right syntx to use ner '..' t line 1"