You seemed to miss of your if else brackets to and also didn't have the ID field in uppercase where it should have been.
You code can be shortened a lot like this:
Index.php
<body>
<?php
// ************* You should put this in a separate file and either require() or include() it e.g. "connectDB.php"
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// ***************** End ****************************
//and possibly this line as well if you only use one db
mysql_select_db("gwines_test") or die(mysql_error());
//****** Run this once....
$result = mysql_query("SELECT ID,Name FROM products")
or die('Blah ' . mysql_error());
$product_id=0;
while($row = mysql_fetch_array($result))
{
$product_id=$row['ID'];
$navList .= "<li><a href=\"product.php?id=" . $product_id . "\">". $row['Name'] ."</a></li>";
}
//*** this next part seems to be unused and can be deleted:
$i=0;
$num=mysql_num_rows($result); ////// Finding all the information in the table and counting the rows
mysql_data_seek($result, 0);
//***end of uselessness *****
?>
<div id="wrapper">
<div id="content">
<div id="header">
<div id="menu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Products</a>
<ul>
<?php echo $navList; ?>
</ul>
</li>
</div>
</div>
<div id="main">
<h1>"Wine is a pleasure that transports us from the present to the past" </h1>
<ul>
<?php
//I added the ul tags too!!
echo $navList; ?>
</ul>
</div>
Product.php
<body>
<?php
// get database connect info
require("connectDB.php");
if(is_numeric($_GET['id']))
{
//since you are calling from the url directly to the sql query, use mysql_real_escape_string() for some security
$product_id= mysql_real_escape_string($_GET['id']);
}
else{
$product_id = -1;
}
// I also notice in your index page your 'id' field in the DB is uppercase so change it to that.
$result = mysql_query("SELECT ID, name, producttype, description, winery, imgloc, thumbloc FROM products WHERE id='" . $product_id . "'")
or die('Blah ' . mysql_error());
$product_id=0;
while($row = mysql_fetch_array($result))
{
$product_id=$row['ID'];
$navList .= "<li><a href=\"product.php?id=" . $product_id . "\">". $row['Name'] ."</a></li>";
}
?>
<div id="wrapper">
<div id="menu">
<li><a href="#">Products</a>
<ul>
<?php echo $navList; ?>
</ul>
</li>
</div>
<div id="main">
<?php
echo "<h4>" . $row['name'] . "</h4><br/>"; ?>
<img src="images/line.png" width="613" height="2" />
<?php
echo '<img src="' . $row['imgloc'] . '" id="prod_img" /><br/>';
echo "<h5>" . $row['name'] . "</h5>";
echo "<p>Description: " . $row['description'] . "<br/>";
echo "Winery: " . $row['winery'] . "<br/>";
echo "<a href=\"index.php\">[Go Back]</a></p>";
?>
</div>