搜尋
首頁php教程php手册adodb+smarty+myClass 结合:数据类的智能操作

/**
*
* @author 风卷残云,
* @copyright Copyright (c) 闲情网站, 2004-2005
* @since ~
*/
/*+++++++++++++++++++++++++
* Copyright (c) 2004,闲情网站
* All rights reserved
*
* 系统名称:闲情音乐
* 文件名称:diary.php
* 文件标识:见配置管理计划书
* 功        能:
* 摘        要:
*
* 当前版本:1.0
* 作        者:风卷残云
* 作者主页:http://freeday.512j.com
* 作者邮箱:bighuang@126.com
* 作者   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
"连接数据库出错!"
;
}


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

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

$my->close
();
$smarty->display('music.htm'
);
require(
"include/footer.php"
);
exit();
?>
 
 
music.htm
table class="toutm" width="768"  align="center"  cellpadding="0" cellspacing="0"
  tr

    td height="25" class="tdbc">总共有歌曲font color="#FF0000">$total}>font>   
    td
 
tr

  tr
>
    td width="768" class="line">
    td>
 
tr
>

  tr
>
    td
>  
      table>
        tr>
          td>
            table>
              section name=secF loop=$musicArr
}>
              tr
>
                   section name=secS loop=$musicArr[secF
]}> 
                  td
>
                       IMG  src="images/11.gif" width=12>A title="" onclick="window.open(this.href,'','top=0,left=0,width=550,height=370,scrollbars=yes,resizable=no');return false;"  href="http://freeday.512j.com/old/wj/sp.php?path=" target=_blank>$musicArr[secF][secS].name}>$musicArr[secF][secS].songer}>A
>
               
 td>
                  section}>
               tr>
               section
}> 
             
table>
           td>
         tr>
       table
     
td

   
tr

   tr

      td width="768"  class="line">td

    
tr
>
table>
 
 
 
 
 
 
更简单的方法:
<font size="2"><font face="verdana,arial,helvetica">代码:</font><hr></font><code><font color="#000000"><font color="#0000bb"><br></font><font color="#007700"><font color="#0000bb">table border</font><font color="#007700">=</font><font color="#dd0000">"1" </font><font color="#0000bb">width</font><font color="#007700">=</font><font color="#dd0000">"599" </font><font color="#0000bb">cellpadding</font><font color="#007700">=</font><font color="#dd0000">"0" </font><font color="#0000bb">cellspacing</font><font color="#007700">=</font><font color="#dd0000">"0" </font><font color="#0000bb">align</font><font color="#007700">=</font><font color="#dd0000">"center"</font><font color="#007700">><br>    <font color="#0000bb">tr</font><font color="#007700">><br>    <font color="#0000bb">section name</font><font color="#007700">=</font><font color="#0000bb">mydata loop</font><font color="#007700">=</font><font color="#0000bb">$news</font><font color="#007700">}><br>        <font color="#0000bb">td width</font><font color="#007700">=</font><font color="#dd0000">"69%" </font><font color="#0000bb">align</font><font color="#007700">=</font><font color="#dd0000">"center"</font><font color="#007700">><br>            <font color="#0000bb">a href</font><font color="#007700">=</font><font color="#dd0000">"#?id="</font><font color="#007700">><font color="#0000bb">$news</font><font color="#007700">[</font><font color="#0000bb">mydata</font><font color="#007700">].</font><font color="#0000bb">news_title</font><font color="#007700">}></font><font color="#0000bb">a</font><font color="#007700">><br>        </font><font color="#0000bb">td</font><font color="#007700">><br>    <font color="#0000bb">$smarty</font><font color="#007700">.</font><font color="#0000bb">section</font><font color="#007700">.</font><font color="#0000bb">mydata</font><font color="#007700">.</font><font color="#0000bb">rownum is div by 3</font><font color="#007700">}><br>    </font><font color="#0000bb">tr</font><font color="#007700">><br>    <font color="#0000bb">tr</font><font color="#007700">><br>    <br>    <font color="#0000bb">section</font><font color="#007700">}><br>    </font><font color="#0000bb">tr</font><font color="#007700">><br></font><font color="#0000bb">table</font><font color="#007700">><br></font><font color="#0000bb"></font></font></font></font></font></font></font></font></font></font></font></code><hr>



陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
4 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版