We'd need more code to help out. A lot of what this code is doing is evidently in a class called CVDB, we'd need to take a look at the methods that class defines to get a good idea.
Off the top of my head, I'd say check the return value of your database query, e.g.
// ($return_value >0 if query succeeds)
if ($return_value = $result->query($q)) {
echo "<h2>deleted</h2>";
} else {
echo "<h2>Record not deleted</h2>";
// check database error string here
}
...
I don't know what database you're using, if it's mysql you should check the value of mysql_error($link_identifier), other DBs will have similar functions associated with them.
Given that you're using a class to access the DB, you might want to add an error() method to your database class of the form:
function error() {
return mysql_error($link_id);
}
and check the return value of that.
HTH,
AC