Hi,
I've been playing around with Smarty and I've come up with this test:
The problem is that it only prints the last row of the table it doesn't loop it and list all the rows even though I put it in a while like I usually do.
What am I doing wrong please?
Thanks
Craig.
I've been playing around with Smarty and I've come up with this test:
Code:
<?php
include 'connection.php';
require '../libs/Smarty.class.php';
$smarty = new Smarty;
$sql = "SELECT * FROM Users";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$username = $row['username'];
$smarty->assign('username', $username);
}
$smarty->display('index.tpl');
?>
The problem is that it only prints the last row of the table it doesn't loop it and list all the rows even though I put it in a while like I usually do.
What am I doing wrong please?
Thanks
Craig.