Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Is there anything wrong with this code or is my hosting not working right?
I got all of this right out of a book that I bought and it isn't working on my site.Code: Select all
<?php
$phptype = 'mysql';
$dbHost = 'localhost';
$database = 'morpiaco_videos';
$username = 'morpiaco_videos';
$password = '********';
$db = DB::connect($dsn);
if (DB::isError($db)) {
die($db->getMessage());
}
$sql = "SELECT title, date, code FROM videos ORDER BY title DESC LIMIT 20";
$result = $db->query($sql);
if (DB::isError($result))
$errorMessage = $result->getMessage();
die($errorMessage);
}
$i=0;
while ($row = $result->fetchRow()) {
$returnArray[$i] = $row[0];
++$i;
}
$db->disconnect();
?>Fatal error: Undefined class name 'db' in /home/morpiaco/public_html/videos.php on line 8
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]