more value in the Smarty template databse

i have php file named testfun.php

<?php
$conn=mysql_connect("localhost","root","") or die("unabke to connect");
$db=mysql_select_db("smartyform",$conn) or die("databse error");

require 'Smarty/libs/Smarty.class.php';

$smarty = new Smarty;

$sel=mysql_query("select * from form");
while($row=mysql_fetch_array($sel))
{
$id=$row[0];
$name=$row[1];
}
$smarty->assign('id',$id);
$smarty->assign('name',$name);

$smarty->display('testfunction.tpl');
    ?>

I have tpl file named testfunction.tpl

<body>

<ul>
{$id}
 :
 {$name}
</ul>

</body>
</html>

when i run the testfun.php i got the output like:

16 : dg

i want output like:

1:d
d:g

what should i do ?

This entry was posted in Codes & Scripts and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>