hi i am trying to make a downloads page for my website i dont want to make a form to add them just yet as i think i can do that by myself but i do want to store information about downloads in a database so i made a table with all the fields i needed in it and now im left with the following fields
ID - auto increace
title - download title
sesc - download discription
dl - download link
size - file size
but anyway i made the code for this and i am left with a small problem it says this message when i open it in my browser...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/virtual/site9/fst/var/www/html/downloads.php on line 12
so if you can help please do here is the whole code of the page.
<?php
include "bnr.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, desc, dl, size FROM downloads";
$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"];
$desc=$r["desc"];
$dl=$r["dl"];
$size=$r["size"];
/* Now lets display the news */
echo "<center><table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='62%' height='344'>
<tr>
<td width='37%' align='right' height='19' valign='top'><font face='Verdana'>
<b>Download Title :</b></font></td>
<td width='66%' height='19'><font face='Verdana'>$title</font></td>
</tr>
<tr>
<td width='37%' align='right' height='19' valign='top'><font face='Verdana'>
<b>Description :</b></font></td>
<td width='66%' height='19'><font face='Verdana'>$desc</font></td>
</tr>
<tr>
<td width='37%' align='right' height='19' valign='top'><font face='Verdana'>
<b>Download :</b></font></td>
<td width='66%' height='19'><font face='Verdana'>$dl</font></td>
</tr>
<tr>
<td width='37%' align='right' height='19' valign='top'><font face='Verdana'>
<b>FileSize :</b></font></td>
<td width='66%' height='19'><font face='Verdana'>$size</font></td>
</tr>
</table></center>";
}
mysql_close($db);
?>
PS
Thanks in advance for any help you may be able to offer i need this real bad before june 1st when my system launches.
to see the site at the moment visit http://www.nukehq.net
for the page with the error "downloads.php" visit
http://www.nukehq.net/downloads.php