二度循环的问题
index.php$sql="select * from big";
$result = mysql_db_query($dbname,$sql);
while ($row = mysql_fetch_row($result))
{
$sql1="select * from small where bigid=".$row[0];
$result1 = mysql_db_query($dbname,$sql1);
while ($row1 = mysql_fetch_row($result1))
{
$small_array[]=array("title"=>$row1[2]);
}
$big_array[] = array("id"=>$row[0],"big"=>$row[1],"topic"=>$small_array);
unset($small_array);
}
$smarty->assign("big",$big_array);
unset($big_array);
$smarty->display("index.tpl");
index.tpl
{--section name=loop1 loop=$big--}
{--$big[loop1].big--}<br><hr>
{--section name=loop2 loop=$big[loop1].topic--}
{--$big[loop1].$topic[loop2].title--}<br>
{--/section--}
{--/section--}
预览出的结果只显示出了big表中的内容,但small表是的内容却没有显示,请各位帮下忙,谢了