json generator / absracted db connection php