Spotting errors inside PHP is a difficult task. Especially if you try to understand the default messages, given by the PHP interpreter. If you want to effectively debug your PHP script, you can use the following code:
error_reporting(E_ALL);
This code will show all errors, notices and warnings generated during the script’s run. It’s very useful for PHP developers.
Also, if you are passing variables via POST or GET requests and you are wondering if the correct variables are transmitted to the script, you can show the full contents of these two request types, by using the simple PHP snippet:
print_r($_REQUEST);
If you need more information, you can check the PHP’s error reporting article.