If $var is equal to $DBCODE, why do you require to use both variables at all.
Moreover, where is $DBCODE getting its value? from a web-based form (as a hidden field)? If yes, you are leaving a huge security jole in there.
Also i guess $DBCODE is a global, you you will need to have:
global $userinfo,$DBCODE;
instead of
global $userinfo;