Was written
> > > while( $row = $result->fetchRow( DB_FETCHMODE_ASSOC ) ) {
> > > $rowdata[$i] = $row;
> > > $i++;
> >
> > I don't think you need the $i.
>
> I need the $i because I'm assigning the every row from the result into
> an array.
http://www.php.net/manual/en/language.types.array.php#language.types.arr
ay.syntax
> This is done by assigning values to the array while specifying the key
> in brackets. You can also omit the key, add an empty pair of brackets
> ("[]") to the variable-name in that case.
> $arr[key] = value;
> $arr[] = value;
> // key is either string or nonnegative integer
> // value can be anything
You really don't have to create $i, it will be created *on the fly*,
works for me.
I took your template and created a simple php script using smarty. It
works. Here it is:
http://www.schoenster.com/tests/smarty.php
and here is the PHP script I wrote:
(not that I used debugging!, that is a real nice helpful touch).
<?php
include_once ( 'Smarty.class.php'); //
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->template_dir = '.';
$smarty->debugging = true;
$action = 'read';
$colors = array('red','blue','green','yellow');
foreach ( $colors as $color ) {
$comments[] = array('nick'=>"nick $color",'comment'=>"comment
$color");
}
$smarty->assign('action',$action);
$smarty->assign('comments',$comments);
$smarty->display('smarty.html');
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php