加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

PHP全路径无限分类导航LINK代码实现

发布时间:2020-05-25 02:57:39 所属栏目:PHP 来源:互联网
导读:?php/*** @param php全路径无限分类*/include(db.inc.php);function getPathCate($cateid){$sql = select * ,concat(path,,,id) fullpath from likecate where id = $cateid;$res = mysql_query($sql);$row = mysql_fetch_assoc($res);$ids = $row[fullpath];

<div class="cnblogs_code">

/**

  • @param php全路径无限分类
    */

include('db.inc.php');
function getPathCate($cateid){
$sql = "select ,concat(path,',id) fullpath from likecate where id = $cateid";
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
$ids = $row['fullpath'];
$sql = "select
from likecate where id in ($ids) orders by id asc";
$res = mysql_query($sql);
$result = array();
while ($row = mysql_fetch_assoc($res)) {
$result[] = $row;
}
return $result;
}

function displayPath($cateid,$link='cate.php?cid='){
$res = getPathCate($cateid);
$str = '';
foreach ($res as $key => $value) {
$str .= "<a href ='{$link}{$value['id']}'>{$value['catename']}";
}

}

echo displayPath(4,'cate.php?p=1&cid=');

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读