endless changes to sql.php, returning json correctly now