This exercise deals with DBMS communication errors. Using your solution to Exercise 4.14 (or version 1.3 of SurnameSearch.php – the actual code is shown in Figure 4.26) add code to handle DBMS communication errors. Your code should meet the following requirements.
(a) When an error occurs while communicating with the DBMS, the error number and associated message are displayed to the end user.
(b) The script includes a PHP constant DEBUG. If no error occurs and DEBUG is TRUE, then write a suitable notice as an HTML comment. (Hint: The PHP statement define("DEBUG", true); names a constant called DEBUG and sets its value to TRUE. To refer to the constant, simply use its name – for example, the PHP statement echo DEBUG; writes the value of the constant DEBUG to the HTTP response.)
(c) When querying the database, if DEBUG is TRUE, then the SQL statement should be written out as an HTML comment whether or not there is a DBMS communication error.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here