use db_safe_firstval for check, like in signup.php