I'm having a problem with something in the batadase I think with this code I'm not being able to show all the authors in my database:it only show 1 author them the other ones don't apear and there is the message i get in the browser is:Warning: Supplied argument is not a valid MySQL result resource in c:\estudar\seguindo livro\indexmngsys.php on line 21.PHP Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<B>Manage Authors</B>
<P align="center"><a href="mngnewauthor.php">Create new author</a></P>
<UL>
<?PHP
$cnx = mysql_connect('localhost','root','');
mysql_select_db('Jokes');
$authors = mysql_query("SELECT ID, Name FROM Authors");
if(!$authors){
echo("<P>Error retrieving authors from database!</P><BR>".
"Error:" . mysql_error());
exit();
}
while($authors = mysql_fetch_array($authors)){ #This is Line 21#
$id = $authors["ID"];
$name = $authors["Name"];
echo("<LI>$name ".
"[<a href='mngeditauthors.php?id=$id'> Edit </a> |
<a href='mngdeleteauthors.php?id=$id'> Delete </a>]");
}
?>
</UL>
<P align="center"><a href="indexmngsys.php">Return to front page</a></P>
</body>
</html>




Bookmarks