don't use $r == DB_OK checks, because they cause PHP warnings when $r is DB_Error...