I've been using .NET for the last 2 years, but I want to try this smarty stuff out. so I 'm having a go, but I'm having a problem with it only printing the first character of my record set.
<?
require 'libs/Smarty.class.php';
include("libs/class.dbconnect.php");
include("configs/dbconfig.php");
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = true;
$myConnect = new DBConnect($dbinfo); //create DB OBJECT
$myConnect->connection(); // Connect to DB Object
$sql = "select user_name from users"; // QUery the DB
$result = $myConnect->db_exe("$sql"); // Execute Query
while ($row = mysql_fetch_array($result) ){
$users[] = $row['user_name'];
}
$smarty->assign("result", $users);
$myConnect->db_close();
$smarty->display('default.tpl');
?>
now this is my default.tpl
{include file="header.tpl" title="My Smarty in Action"}
<div id=mydiv>
{section name=i loop=$result}
Username: {$result[i].user_name}<br>
{/section}
</div>
I only get this as output
username: m
username: j
the debugger is picking up the fact that it's matt, joe but not displaying it as a string.
Any clues to why it's only printing the first characters ?
Thanks in advance