Replacing db_select code with D7-compliant code