I'm getting the following error message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\apache\htdocs\newsboard\story.php on line 22
I'm trying to make a basic news posting script and I have the following code in a file called 'story.php'. Does anyone know what I have done wrong?
Thanks.
<html>
<head>
<title>test</title>
</head>
<body>
<?php>
require_once("connect.php");
?>
<?php
// Selects the fields that will be displayed
$query="SELECT news_title,news_story,from news ORDER BY news_ID DESC";
$result=mysql_query($query,$connect);
// This formats the table
echo "<table width=400, border=1, align='center'>\n";
echo "<tr><td>
<font color='navy'>Newsboard</td></tr>";
// This writes the data that has been selected
for($i=0;$i<mysql_num_rows($result);$i++){
list($news_title,$news_story)=mysql_fetch_row($result);
echo "<tr><td>$news_title $news_story</td>\n";
}
mysql_close($connect);
// This closes the table
echo "</tr><tr><td bgcolor='red'> </td></tr>\n";
echo "</table>\n";
?>
</body>
</html>