Prev | Current Page 117 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


The errors of type E_WARNING are pretty tricky, because you don??™t know which of them should stop the execution
of the request. The IS_WARNING_FATAL constant set in config.php decides whether this type of error should
be considered fatal for the project. Also, errors of type E_NOTICE and E_USER_NOTICE are not considered fatal:
/* Warnings don't abort execution if IS_WARNING_FATAL is false
E_NOTICE and E_USER_NOTICE errors don't abort execution */
if (($errNo == E_WARNING && IS_WARNING_FATAL == false) ||
($errNo == E_NOTICE || $errNo == E_USER_NOTICE))
// If the error is nonfatal ...
{
// Show message only if DEBUGGING is true
if (DEBUGGING == true)
echo '
' . $error_message . '
';
}
else
// If error is fatal ...
{
// Show error message
if (DEBUGGING == true)
echo '
' . $error_message . '
';
else
echo SITE_GENERIC_ERROR_MESSAGE;
// Stop processing the request
exit();
}
In the following chapters, you??™ll need to manually trigger errors using the trigger_error() PHP function, which
lets you specify the kind of error to generate. By default, it generates E_USER_NOTICE errors, which are not considered
fatal but are logged and reported by ErrorHandler::Handler() code.
Preparing the Database
The final step in this chapter is to create the MySQL database, although you won??™t use it until
the next chapter.


Pages:
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
wentylacja spolszczenia wczasy RSS news świnoujście