首頁 >php教程 >php手册 >取得phpcms网站下所有栏目的内容链接

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

WBOY
WBOY原創
2016-06-13 10:58:511524瀏覽

<?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>";           
        }  
    }  
?>  

 

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