I'm still a little confused what specifically your attempting to do here.
But as for accessing information stored in a dbnpc, I recommend making public functions in the dbnpc and calling them to get what you need.
PHP Code:
public function getInfo(category, account, item){
return this.items.(@category).(@account).(@item);
}
public function getCategories(){
clearemptyvars();
return this.items.getdynamicvarnames();
}
Something like that...