Hello I am new to PHP and I suck but I was wondering why I would be getting this error:
"Warning: Supplied argument is not a valid MySQL result resource in C:\apache\htdocs\bao\news.php on line 11" Everything executes perfect but that error always shows after everything! Thank you soooo much in advance.
Here is the code:
<?php
include("header.php");
include("vars.php");
mysql_pconnect("$host","$user","$password");
mysql_select_db("$database");
$result=MYSQL_QUERY("select * from $table order by date limit 5");
while($x=mysql_fetch_array($result)):
$author=$x["author"];
$subject=$x["subject"];
$date=$x["date"];
$news=$x["news"];
$news_id=$x["news_id"];
if ($viewnews == $news_id) {
$result=MYSQL_QUERY("select * $news from $table");
echo "<table width=41% cellpadding=0 cellspacing=0>
<tr>
<td>
<div align=right><font face=impact><h1>$subject</h1></font></div>
</td>
</tr>
<tr>
<td><img src=img/news/$author.jpg align=left><font face=arial>$news</td>
</tr>
<tr>
<td>
<div align=right><font face=arial><font size=-2>Posted by: <b>$author</b><br>$date</font></font></div>
</td>
</tr>
</table>
<br><img src=img/news/line.jpg><br>
";
} else {
echo ('No Such News. Go back!');
}
endwhile;
include("footer.php")
?>