non è chiaro il tipo di db.
Per mysql puoi verificare da php con mysql_error()