Update db.php

Changed conditionals for a cleanest switch statement