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

WBOY
发布: 2016-07-15 13:21:49
原创
1221 人浏览过

<?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
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板