A warning to ye... I can't impress upon ye enough: set error_handling to E_ALL (verbose) when developing PHP. You will cut your errors in half. You can do this in three ways:
- uncomment the following line in your php.ini file: error_reporting = E_ALL . This will affect all PHP scripts
- add the line
error_reporting = 2047 in an .htaccess file. This will affect only php files in or below the directory of the .htaccess file.
- add a line of code at the start of every php page:
error_reporting (E_ALL); This will affect only the files that you alter.
After you do this you may get a whole page of warnings about undeclared variables. This is a good thing, since it forces you to declare all variables and lets you know when you introduce new ones into the mix by mistake. You will at some point mis-type variable names. Without error reporting turned verbose, PHP accepts these mistakes as real variables:
$species_code = "WAE";
if($speces_code == "WAE"){ //do stuff}
The above code exhibits a bad feature of PHP; that you don't need to declare variables before using them. I introduced a variable called speces_code to the PHP script and since it is blank it is not equal to "WAE". It just skipped over this comparison without a blink!
Also, set error reporting to zero when in production so that visitors cannot peer into the inner workings of your code and directory structure when they encounter an error.
11:47:51 AM
|