change line 41:
$query_rsConfirm = sprintf("SELECT * FROM contacts WHERE contacts.`key`== $%s", GetSQLValueString($keyvalue_rsConfirm, "text"));
to:
$query_rsConfirm = sprintf("SELECT * FROM contacts WHERE contacts.`key` = %s", GetSQLValueString($keyvalue_rsConfirm, "text"));