added logs for PHP errors and MySQL queries