I'm working on my first module, and I have a simple form in the admin panel to take 3 values. I am trying to insert these values into the database table that was setup on install of the module. The problem is... the values aren't inserting, and I don't know where to go for an error message? I'm trying to use $db->ErrorMsg(), but it's not returning anything. Help?

Some code follows...
Code: Select all
// Add contact to db
$query = "INSERT INTO " .cms_db_prefix()."module_hotccontacts_contacts".
" (name,email,position) VALUES (?,?,?)";
$p = array('name','email','position');
$dbresult=$db->Execute($query, $p);
if (!$dbresult) {
$params2['error'] = $db->ErrorMsg();
$this->displayadminpanel($id,$params2,$returnid);
}else {
$this->Redirect($id,'defaultadmin',$returnid);
}
In the displayadminpanel function, I have it look for the error param and display it in the admin panel. If I remove $db->ErrorMsg() and replace it with something else, that something else does show up. So apparently, $db->ErrorMsg() isn't returning anything, but there is obviously an error of some sort since my fields didn't insert into the database.