I am building a website (selling electronic devices) and have created a while statement to list all my lcd tvs. I want to create a link at the end of each row so when it is clicked the user will view more information on the selected product. Any ideas on how to do so? What variable do I parse and what does the output page capture? See code below:
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql=("SELECT * FROM television WHERE type='lcd'");
$result=mysql_query($sql)or die(mysql_error());
echo "<table align=\"center\" width=\"40%\" border=\"1\">";
echo "<tr>";
echo "<th>Image</th>";
echo "<th>Product Id</th>";
echo "<th>Brand</th>";
echo "<th>Model No</th>";
echo "<th>Type</th>";
echo "<th>Description</th>";
echo "<th>Purchase</th>";
echo "</tr>";
while ($row = mysql_fetch_array($result)){
$id=$row['id'];
echo "<tr>";
echo "<td align=\"center\"><img src=\"".$row['pic']."\"/></td>";
echo "<td><input type=\"text\" size=\"6\" name=\"productid\" value=".$row['prodid']." style=\"text-align:center;border:0px;\" READONLY/></td>";
echo "<td align=\"center\">".$row['brand']."</td>";
echo "<td align=\"center\">".$row['modelno']."</td>";
echo "<td align=\"center\">".$row['type']."</td>";
echo "<td align=\"center\"><a href=\"info.php?id=$id\"><img src=\"images/moreinfo.gif\" border=\"0\" alt=\"\" /></td>";
echo "<td align=\"center\"> </td>";
echo "</tr>";
}
echo "</table>";
mysql_close($db_name);
?>