首页 > 教程 > 前端技术 > 标签调用

    收藏

    destoon调用当前栏目分类在中发布过商品的公司
    2022-10-08标签调用13℃
    广告
    核心提示:打开/include/global.func.php在最后边加上以下代码:function get_com($catid){global $db;$sql = "select * from ".$db-pre."category where catid=".$catid.""; //调用当前栏目所有子分类$result = mysql_query($sql);$catids = '';while($coun
    打开/include/global.func.php
    在最后边加上以下代码:
    function get_com($catid){
    	global $db;
    	$sql = "select * from ".$db->pre."category where catid=".$catid.""; //调用当前栏目所有子分类
    	$result = mysql_query($sql);
    	$catids = '';
    	while($count=mysql_fetch_array($result)) {
    		$catids .= $count['arrchildid'];
    	}
    	$row = array();
    	$sql2 = "select a.username,a.userid,a.company, COUNT(b.itemid) AS com_num from ".$db->pre."member as a,".$db->pre."mall as b where a.username=b.username and b.catid in ($catids) GROUP BY b.username HAVINg com_num > 0 ";
    	$result2 = mysql_query($sql2);
    	while($count2 = mysql_fetch_array($result2)) {
    		$row[] = $count2;
    	}
    	return $row;
    }

    代码内容不解释
    再打开你要用的模板,模板地方参考以下代码,自行修改
    {php $cominfo=get_com($c[catid]);}
    {loop $cominfo $i $t}
    <a rel="nofollow" title="{$t[company]}" target="_blank" href="{userurl($t[username])}"><span>{$t[company]}</span></a>
    {/loop}

    $c[catid]是上一层loop遍历出来的.把数据取出来了,遍历跟据自己情况写loop吧.
 
  • 文本链接:https://mbtxw.com/Course/show.php?itemid=132
  • 文章来源:模板模板
  • 版权声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。
标签: 产品 公司 信息
0相关评论