Update Database.php

Remove unnecessary temporary variables and refactor the callback the use array function and prevent sql Injection