Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

yet another looping problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mystrymaster
Smarty Rookie


Joined: 31 Oct 2003
Posts: 17

PostPosted: Fri Oct 31, 2003 2:30 pm    Post subject: yet another looping problem Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP