i recently re-installed my system i installed the same software as before but for some odd reason my php news system doesnt seem to work help would be aprecated thank here is the error i keep getting...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\program files\apache group\apache\htdocs\admin\show_news.php on line 11
help would be great thanks ! by the way here is the code of that page with the error...
This is called "show_news.php" please try and help thanks.
<?php
include "config.php";
$db = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db ($db_name) or die ("Cannot connect to database");
/* We have now connected, unless you got an error message */
/* Lets extract the data (news) from the database */
$query = "SELECT title, news, author, date FROM news ORDER BY id DESC LIMIT 10";
$result = mysql_query($query);
/* Here we fetch the result as an array */
while($r=mysql_fetch_array($result))
{
/* This bit sets our data from each row as variables, to make it easier to display */
$title=$r["title"];
$news=$r["news"];
$author=$r["author"];
$date=$r["date"];
/* Now lets display the news */
echo "<center><table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFFFFF' width='100%'>
<tr>
<td width='100%'>
<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFFFFF' width='100%'>
<tr>
<td width='100%'>
<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFFFFF' width='100%'>
<tr>
<td width='100%' bgcolor='#CCFFFF'>
<font face='Verdana'><b>$title</b></font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width='100%'>
<font face='Verdana' color='#FFFFFF'>$news</font></td>
</tr>
<tr>
<td width='100%'>
<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFFFFF' width='100%'>
<tr>
<td width='100%'>
<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFFFFF' width='100%'>
<tr>
<td width='100%' bgcolor='#CCFFFF'>
<font face='Verdana'>Posted by <b>$author</b> on $date</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table></center>";
}
mysql_close($db);
?>
i look forward to hearing replys thanks.