tailieunhanh - PHP and MySQL Web Development - P99

PHP and MySQL Web Development - P99: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 462 Chapter 23 Debugging cannot automatically tell you that a particular line will generate an testing needs to provide one of the situations that create the error. Handling runtime errors requires a certain amount of forethought to check for different types of failure that might occur and then take appropriate action. It also takes careful testing to simulate each class of runtime error that might occur. This does not mean that you need to attempt to simulate every different error that might occur. MySQL for example can provide one of around 200 different error numbers and do need to simulate an error in each function call that is likely to result in an error and an error of each type that is handled by a different block of code. Failure to Check Input Data Often we make assumptions about the input data that will be entered by users. If this data does not fit our expectations it might cause an error either a runtime error or a logic error detailed in the following section . A classic example of a runtime error occurs when we are dealing with user input data and we forget to AddSlashes to means if we have a user with a name such as O Grady that contains an apostrophe we will get an error from the database function. We will talk more about errors because of assumptions about input data in the next section. Logic Errors Logic errors can be the hardest type of error to find and eliminate. This type of error is where perfectly valid code does exactly what it is instructed to do but that was not what the writer intended. Logic errors can be caused by a simple typing error such as for i 0 i 10 i echo doing something br This snippet of code is perfectly valid. It follows valid PHP syntax. It does not rely on any external services so it is unlikely to fail at runtime. Unless you looked at it very carefully it probably will not do what you think it will or what the programmer intended it to do. At a glance it looks as if it will iterate .

TỪ KHÓA LIÊN QUAN