Greetings, such a question: how to output an array of data using smarty
? In PHP, everything is easy and simple.
while ($my = mysql_fetch_array ($array)) { $i++; $title[$i]=$my['title'] $content[$i]=$my['content'] }
But how I tried to implement on Smarti
$query = mysql_query("SELECT * FROM table WHERE author='".$go."' LIMIT 1"); $rows=array(); while ($row=mysql_fetch_array($query)){ $rows[]=$row; } $smarty->assign('data',$rows);
Well, in the very * tpl already
{foreach from=$data item=item} <p>{$item.title}</p> {/foreach}
As a result, only one of the two records is displayed. What I did wrong?