I am starting a new thread for this topic as now it's about displaying retrieved DB data as opposed to the other thread just finished on how to successfully retriev DB data.
As you look at the code below, you will notice that I have two TD's being echoed, but since there are more entries in the DB table than two values, the code simply keeps creating data cells to hold the information. I don't want it to do that; I want the TH cell only to be there once and the AudioTitles to appear in the same column listed below.
Does that make any sense? How do I do that? Got a link?
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Query test page</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-language" content="en-us" />
<meta http-equiv="Imagetoolbar" content="no" />
<link rel="stylesheet" href="sah-css.css" type="text/css" />
</head>
<body>
<table cellpadding="5" cellspacing="0" border="1">
<?php include_once ("config.php");
$sql = "SELECT AudioID, AudioTitle, AudioDate FROM sermonaudio";
$result = mysql_query($sql, $db);
$count = mysql_num_rows($result);
if($count == 0)
{
echo '<p>No records available.</p>';
}
while($row = mysql_fetch_assoc($result))
{
$AudioID = $row['AudioID'];
$AudioTitle = stripslashes($row['AudioTitle']);
$AudioDate = date("d.m.y",$row['AudioDate']);
echo '<tr>';
echo '<th>Title</th>';
echo '</tr>';
echo '<tr>';
echo '<td>'.$AudioTitle.'</td>';
echo '</tr>';
}
?>
</table>
</body>
</html>
Thanks,
Shad