|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mystrymaster Smarty Rookie
Joined: 31 Oct 2003 Posts: 17
|
Posted: Fri Oct 31, 2003 2:30 pm Post subject: yet another looping problem |
|
|
Sorry about this but I searched through the forums and I have followed all I found however I still have a problem.
[php:1:b4591f33fb]
$sql = "select * from test_table";
$result = $db->query($sql);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$rows[] = $row;
}
$smarty->assign("rows", $rows);
$smarty->display('test.tpl');
[/php:1:b4591f33fb]
That is the query I am working with
Now here is the template
I have tried 2 ways
Code: |
{foreach from=$rows item="row"}
name: {$row.name}<br>
address: {$row.address}<br>
city: {$row.town}<BR><BR>
{/foreach}
{section name=i loop=$rows}
Name: {$rows[i].name}<br/>
{/section}
|
I have also inserted a print_r for the rows array and I am getting everything in it. It is just not looping through it on the template end.
Any help would be appreciated.
Disregard I figured out my problem - I was referenceing them lowercase when they should have been caps.....IDIOT |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|