一聚教程网:一个值得你收藏的教程网站

热门教程

Smarty分列显示:有些可以变得更简单

时间:2022-07-02 10:48:21 编辑:袖梨 来源:一聚教程网


include "config/config.php";
include "config/dbclass.php";
include "include/FreeDayCodeChange.php";
$my = new mydb();
$my->c_all($db_host,$db_user,$db_psw,$db_table);
//require("include/sess.php");

$my = new mydb();
$my->c_all($db_host,$db_user,$db_psw,$db_table);

require("include/header.php");
require("config/Smarty_Freeday.php");

$smarty = new Smarty_Freeday;

$query = "select count(*) from fd_music order by MC_id desc";
$res =$my->query($query);
$total = $my->fetch_arr($res);
$total = $total[0];


$queryN = "select * from fd_music order by MC_id desc";
$result =$my->query($queryN);
$i = "0";
$j = "1";
$musicArr = array();
if ($result)
{
while ($n = $my->fetch_arr($result))
{

$i ;
$musicItem[$j-1][name] = $n[MC_name];
$musicItem[$j-1][songer] = $n[MC_songer];
$musicItem[$j-1][url] = $n[MC_url];
$j ;



if($i==$total && $j%5!=0)
{
$musicArr[] = $musicItem;
}

if($j%5 == 0)
{
$musicArr[] = $musicItem;
$musicItem = "";
$j = "1";
}
}
}
else
{
echo "连接数据库出错!";
}


$smarty->assign('total',$total);

热门栏目