I think I have found an error in Example 7-24 of PHP Cookbook by Adam Trachtenberg and David Sklar.
I copied the code exactly as it is in the online version of the book at Safari. When I then used the code in Example 7-25, php produced the following error:
[01-Mar-2013 15:58:16 UTC] PHP Fatal error: Declaration of MySQL::connect() must be compatible with that of Database::connect() in /var/www/fbmeta/test.php on line 27
[01-Mar-2013 16:00:01 UTC] PHP Fatal error: Declaration of MySQL::query() must be compatible with that of Database::query() in /var/www/fbmeta/test.php on line 27
I changed the code in example 7-24 to the following:
abstract class Database {
abstract public function connect($server, $username, $password, $database);
abstract public function query($sql);
abstract public function fetch();
abstract public function close();
}
All was well!
Hope that helps somebody. I was very frustrated because I am just learning OOP and had no clue what was giving me the 500 error.
Thank you for making great books.
-
Hello Dm Mmd,
Thank you for your interest in O'Reilly books. You can submit errata for the PHP Cookbook here: http://oreilly.com/catalog/errata.csp.... Have a great day and we appreciate the feedback!
Kind regards,
Paul Fichera
Customer Service Representative
O'Reilly Media -