What wrong with this code i getting error please help
hi i'm using this book practical-php-and-mysql-r-building-eight-dynamic-web-applications-negus-live-linux-series.9780132239974.27359
and i'm on page 89 say in adobe and on the page itself sasys 75
so my problen is i done all as it say type all code and then i type this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>index.php</title>
</head>
<body>
<?php
require ("header.php");
$sql = "SELECT entries.*, categories.cat FROM entries, categories
WHERE entries.cat_id = categories.id
ORDER BY dateposted DESC
LIMIT 1;";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo "<h2><a href= 'viewentry.php? id= ". $row['id']
."'>" . $row['subject'].
"</a></h2><br />";
echo "<i> In <a href ='viewcat.php?id=" . $row['cat_id']
."'>" . $row['cat'] .
"</a> - Posted on " . date("D jS F Y g.iA ",
strtotime($row['dateposted'])). "</i>";
echo "<p>";
echo nl2br($row['body']);
echo "</p>";
require ("footer.php");
?>
</body>
</html>
and when i run it i get
error
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in G:\wamp\www\index.php on line 17
please help any thing i need to configure in php or apache or mysql
thanks for any help please i'm dying
|