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

html_table parsing an assoc array 2D

 
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
virgil
Smarty n00b


Joined: 16 Jul 2003
Posts: 3

PostPosted: Wed Jul 16, 2003 3:56 pm    Post subject: html_table parsing an assoc array 2D Reply with quote

I'm squizing my brains out for this one.

I have this array with 16 iterations:
Code:

while($row = $result->fetchrow(DB_FETCHMODE_ASSOC )){
      $dvd[] = array( "id" => $row["id"],
                              "name" => $row["name"],
                              "email" => $row["email"]
                              );
      }
 

And I want to parse this array into a table with 4 cols using html_table like:
Code:
 
{html_table cols=4 loop=$dvd} //This is not working
 

Please show me the light!
_________________
Virgil Iancu
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jul 18, 2003 12:59 am    Post subject: Reply with quote

Try this instead:
Code:
while($row = $result->fetchrow(DB_FETCHMODE_ASSOC )) {
  $dvd[] = $row["id"];
  $dvd[] = $row["name"];
  $dvd[] = $row["email"];
  $dvd[] = ' & nbsp;';
}


AFAIK, html_table expects a list, not an array of associative arrays. That's why the $dvd[] = '& nbsp;' is there--so that html_table pads that fourth column.

HTH

note: '& nbsp' should not have a space, but the forum seems to not like that...
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