i am working on creating php templates for an application, but i am not understanding how to cover while loop in templates, my code is as follow, that is not right and of course not working at all, it is being posted just for example. Please any body give me an idea that how it can be implemented,
<?php
require_once("temp-test.php");
mysql_connect("localhost", "root","")or die("cannot connect");
mysql_select_db("test") or die("cannot select DB");
$sql="SELECT rid,tid,name FROM reply";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$rid=$row[rid];
$tid=$row[tid];
$name=$row[name];
}
?>
the temp-test.php file as follow
<html>
<head>
<title>template</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="360" height="100">
<tr><td width="358" height="100">
<p style="margin-left: 10; margin-top: 0; margin-bottom: 5"><font face="Segoe UI">Reply ID:<font color="#DA251D">
<?php echo "$rid";?></font></font></p>
<p style="margin-left: 10; margin-top: 0; margin-bottom: 5"><font face="Segoe UI">Topic ID:<font color="#DA251D"><?php echo "$tid";?></font></font></p>
<p style="margin-left: 10; margin-top: 0; margin-bottom: 5"><font face="Segoe UI">Name: <font color="#DA251D"><?php echo "$name";?>
</font></font></p></td></tr></table><br>
</body>
</html>
any suggestion please, thanks in advance....