phpli连接一表,让他安異方循環出来
php文件
$sql = "SELECT * FROM `pp_vod` where vod_cid = 8 order by vod_addtime LIMIT 0 , 12";
$query = mysql_query($sql);
$i = mysql_num_rows($query);
$j = 0;
while($a = mysql_fetch_array($query)){
if ( $j < = $i){
$id[$j] = $a['vod_id'];
$area[$j] = $a['vod_area'];
$hits[ $j] = $a['vod_hits'];
$title[$j] = $a['vod_name'];
$author[$j] = $a['vod_actor'];
$authoreml[$j] = $a['authoreml'];
$putdate[$j] = $a['vod_addtime'];
$pic[$j] = $a['vod_pic' ];
$cat[$j] = $a['vod_cid'];
$content[$j] = $a['vod_content'];
$j++;
}
}
$t->set_file("main","3333.htm");
$t -> set_block("main","row","rows");
for($j = 0; $j < 12; $j++){
$t -> set_var(array("authoreml" => $authoreml[$j],
"author" => $author[$j],
"id" => $id[$j],
"title" => $title[$j],
"putdate" => $putdate[$j],
"pic" =>$pic[$j]);
$t -> parse("rows","row",ture);
}
$t->parse("out","main",true);
/*
こちらメソッド共有の 3 つのパラメータ、目前私が先だけ使用する前の 2 つ。最初のパラメータは会議で出力される名前、2 番目のパラメータは前に決定されたモジュールファイルのときの名前です。
*/
//出力
$t->p("out");
模板文子