PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
this code works perfectly when I run it on my machine (I am using Apache Web server), but the same line produces an error when I run it on Xitami Web server.
This is the error:
"Notice: Use of undefined constant xxx - assumed 'xxx' in
> C:\xitami-25\app\webpages\file.inc.php on line 186"
Is my code correct?
Is it a configuration error in the Xitami installation?
Its a notice that the server doesn't recognize the variable xxx, it should not cause the script to fail. It got this recently when I initialized all my variables to empty strings or 0 fo numerical variables...
I simly turned off error handling(only allowing fatal errors to kill the script) when the script was complete. Notices and Warning are no longer displayed. Place the below at the top of the script...
// redefine the user error constants - PHP 4 only
define("FATAL", E_USER_ERROR);
define("ERROR", E_USER_WARNING);
define("WARNING", E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL);
lostboy wrote:Its a notice that the server doesn't recognize the variable xxx, it should not cause the script to fail. It got this recently when I initialized all my variables to empty strings or 0 fo numerical variables...
I simly turned off error handling(only allowing fatal errors to kill the script) when the script was complete. Notices and Warning are no longer displayed. Place the below at the top of the script...
// redefine the user error constants - PHP 4 only
define("FATAL", E_USER_ERROR);
define("ERROR", E_USER_WARNING);
define("WARNING", E_USER_NOTICE);
// set the error reporting level for this script
error_reporting(FATAL);
Please read the Posting Guidelines (linked from my sig and Sami's) turning down error reporting is NOT a solution it just hides the errors instead of fixing them - when you're developing error reporting should always be at E_ALL.
As Steveo31 pointed out, there is a much better solution to this, using quotes around array elements.