Home  >  Article  >  Backend Development  >  phpli联接一个表,让他安不同的方循环出来

phpli联接一个表,让他安不同的方循环出来

WBOY
WBOYOriginal
2016-06-13 10:34:16837browse

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
  $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   $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);
/*
此方法共有三个参数,目前我们先只用前两个.第一个参数为一会要输出的名称,第二个参数为之前定义模板文件时的名称.
*/
//输出
$t->p("out");
模板文件




  • {title} 全集{putdate}



  • 这个是安添加时间循环出来的,去还要让他安点击循环出来怎么办??一个一个写出来太多了

    ------解决方案--------------------
    这么古老的模板引擎,估计现在是没人用了。
    不过这不是问题的关键

    关键在于:实在没法理解你的需求
    这个是安添加时间循环出来的,去还要让他安点击循环出来怎么办??一个一个写出来太多了
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn