June 2010
Intermediate to advanced
328 pages
7h 51m
English
Developers commonly practice the See No Evil antipattern in two forms: first, ignoring the return values of a database API; and second, reading fragments of SQL code interspersed with application code. In both cases, developers fail to use information that is easily available to them.
| See-No-Evil/anti/no-check.php | |
| | <?php |
| ① | $pdo = new PDO("mysql:dbname=test;host=db.example.com", |
| | "dbuser", "dbpassword"); |
| | $sql = "SELECT bug_id, summary, date_reported FROM Bugs |
| | WHERE assigned_to = ? AND status = ?"; |
| ② | $stmt = $dbh->prepare($sql); |
| ③ | $stmt->execute(array(1, "OPEN")); |
| ④ | $bug = $stmt->fetch(); |
This code is concise, but there are several places in this ...
Read now
Unlock full access