取得phpcms网站下所有栏目的内容链接_PHP教程

WBOY
發布: 2016-07-15 13:21:49
原創
1219 人瀏覽過

<?php  
    $conf[&#39;DB_USER&#39;] = &#39;user&#39;;  
    $conf[&#39;DB_PWD&#39;] = &#39;pwd&#39;;  
    $conf[&#39;DB_NAME&#39;] = &#39;dbname&#39;;  
    $conn = mysql_connect(&#39;localhost&#39;,$conf[&#39;DB_USER&#39;],$conf[&#39;DB_PWD&#39;]);  
    if (!$conn) {  
        echo &#39;数据库连接错误!&#39;;  
    }  
    mysql_set_charset(&#39;utf8&#39;, $conn);        //set charset  
    mysql_select_db($conf[&#39;DB_NAME&#39;]);       //select datebase     
    $sql2 = &#39;select catid,catname from v9_category&#39;;  
    $cat = mysql_query($sql2);  
    while ($catrow=mysql_fetch_array($cat)) {  
        echo $catrow[&#39;catname&#39;].&#39;</br>&#39;;  
        $sql = &#39;(select title,url from v9_news where catid=&#39;.$catrow["catid"].&#39; order by id desc)   
         UNION (select title,url from v9_product where catid=&#39;.$catrow["catid"].&#39; order by id desc)&#39;;  
        $result = mysql_query($sql);  
        while ($row=mysql_fetch_array($result)) {     
            echo $row[&#39;url&#39;]."</br>";           
        }  
    }  
?>  
登入後複製

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477135.htmlTechArticle?php $conf[DB_USER] = user; $conf[DB_PWD] = pwd; $conf[DB_NAME] = dbname; $conn = mysql_connect(localhost,$conf[DB_USER],$conf[DB_PWD]); if (!$conn) { echo 数据库连接错误!...
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板