separating sql from php