首页 > 开发 > PHP > 正文

adodb+smarty+myClass 结合:数据类的智能操作

2024-05-04 23:04:28
字体:
来源:转载
供稿:网友
<?php
/**
*
* @author 风卷残云, <bighuang at 126 dot com>
* @copyright copyright (c) 闲情网站, 2004-2005
* @since ~
*/
/*+++++++++++++++++++++++++
* copyright (c) 2004,闲情网站
* all rights reserved
*
* 系统名称:闲情音乐
* 文件名称:diary.php
* 文件标识:见配置管理计划书
* 功        能:
* 摘        要:
*
* 当前版本:1.0
* 作        者:风卷残云
* 作者主页:http://freeday.512j.com
* 作者邮箱:[email protected]
* 作者   qq:121173553
* 完成日期:2005年4月3日
*
* 取代版本:1.0
* 原  作  者:风卷残云
* 完成日期:2005年4月3日
+++++++++++++++++++++++++*/
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
);

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

$my->close
();
$smarty->display('music.htm'
);
require(
"include/footer.php"
);
exit();
?>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表