ok right now i have a simple database consiting of one table and 4 colums. so far i have been able to get php to communicate with mysql and show me all the data in the database. now i want to create a link that will display just one of the rows of information. for example, say you have a list of companies and when you click the company name it displays a page with just the details of that company. i know that the link has to be like this:
<a href="post.php?id=<?php echo "$id";?>">id</a>
also i know that the query has to be setup like this:
$query = "SELECT * FROM entries WHERE ID = '$id'";
but for some reason the page won’t display the information. it just comes up as a blank page.
here is the code i have for the page:
<?php
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to Select Database.");
$query = "SELECT * FROM entries WHERE ID = '$id'";
$result = mysql_query($query);
mysql_close();
while ($row = mysql_fetch_array($result)) {
list($id, $name, $website, $entry) = $row;
?>
<table border="0" cellspacing="0" cellpadding="0" width="700">
<tr>
<td width="50%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font face="Arial, Helvetica, sans-serif">id:<?php echo "$id";?></a></font></td>
</tr>
<tr>
<td><font face="Arial, Helvetica, sans-serif">name:<?php echo"$name";?></font></td>
</tr>
<tr>
<td><font face="Arial, Helvetica, sans-serif">website:<a href="<?php echo"$website";?>"><?php echo"$website";?></a></font></td>
</tr>
</table>
</td>
<td width="50%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><?php echo "$entry";?></td>
</tr>
</table>
</td>
</tr>
</table>
</br>
<?php
}
?>
any help will be greatly appreciated.