I'm not able to get this example to work. Here is my code for totalfilms-function.inc.php where titles = the name of a table in my db:
include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.php';
$result = $GLOBALS['pdo']->query('SELECT COUNT(*) FROM titles');
catch (PDOException $e)
$error = 'Database error counting films!';
$row = $result->fetch();
The only other file I have in the totalfilms directory is error.html.php. When I load up the directory this is what I get:
It seems I need another file to display the result of the totalfilms function but I'm not sure how to write it.
I guess your index.php is missing. Are you sure in the book there isn't another part of the example?
Thanks! The book doesn't mention it but the missing files are included in the code archive.
This topic is now closed. New replies are no longer allowed.