# Displaying just one row in db?

**URL:** <https://forum.kirupa.com/t/displaying-just-one-row-in-db/190360>\
**Category:** Uncategorized\
**Created:** [June 11, 2006, 12:19am UTC](https://forum.kirupa.com/t/displaying-just-one-row-in-db/190360 "2006-06-11T00:19:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meistertoca](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@meistertoca](https://forum.kirupa.com/u/meistertoca)\
**Post date:** [June 11, 2006, 12:19am UTC](https://forum.kirupa.com/t/displaying-just-one-row-in-db/190360/1 "2006-06-11T00:19:57Z")

</div>

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:

```auto
<a href="post.php?id=<?php echo "$id";?>">id</a>

```

also i know that the query has to be setup like this:

```php
$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
<?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. 🙂
