Another Array-Loop-Question
| From: | Jones Down | Date: | Mon, 08 Apr 2002 23:34:44 +0000 |
| Subject: | Another Array-Loop-Question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3566@lists.php.net to get a copy of this message | ||
Hi,
smarty is really smart, especially handling of arrays is tricky, too
tricky for me at the moment... maybe someone can help me, I am stuck
with that and can´t go on... pleeease...
I have an array like this:
while ($db->next_record()) {
$CATS[$db->f('id')] = array ($db->f('name'),
$db->f('indent') );
}
an other view is:
$CATS [1005] [0] = Science Fiction
$CATS [1005] [1] = 2
$CATS [1006] [0] = Fantasy
$CATS [1006] [1] = 2
How can I access this array in a template, so I get
something like this:
foreach ($CATS as $key => $val) {
echo $key.'->'. $val[0].'->'. $val[1].NL;
}
what results in
1005 -> Science Fiction -> 2
1006 -> Fantasy -> 2
How can this be done???
THANK YOU!!!
Have a nice day,
Jones