首页  >  文章  >  后端开发  >  取得phpcms网站下所有栏目的内容链接_PHP教程

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

WBOY
WBOY原创
2016-07-15 13:21:491222浏览

<?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 数据库连接错误!...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn