首页 > php框架 > Smarty分列显示:有些可以变得更简单

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

<?php
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 "<tr><td align=center >连接数据库出错!</td></tr>";
}
$smarty->assign('total', $total);


文章网址:http://www.phprm.com/frame/c4daad55dce126b66ae67e0fe133d117.html

随意转载^^但请附上教程地址。

标签:none

发表留言