Update dbmodel.php

Numerous bug fixes, Support for wildcard searches.