如何显示username?

hhitjsj021 hhitjsj021 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
一个消费排行榜模块:我用关联查询,(table_1是用户表 tbale_6是订单表, 我的订单表中没有username )查询出了用户ID(userid)
#消费多的用户ID
function customers()
{
global $db,$table_6,$table_1;
$sql = "SELECT userid, count( userid ) AS t
FROM $table_6 where userid in (select userid from $table_1)
GROUP BY userid
ORDER BY t DESC
LIMIT 6";
$rel=$db->query($sql);
while($obj =@Mysql_Fetch_Array($rel))
{

$info[] =$obj["userid"];

}
return $info;
}
下面是我显示消费多的用户ID(userid) 但是我想显示用户名即username.
#消费排行榜
$customers = $smarty->customers();
$customers_str="";
if(count($customers))
{
foreach($customers as $key=>$value)
{
$customers_str.=<<<EOF
<span class="new_customers">{$customers[$key]['userid']}</span>
EOF;
}
}
新人,望大侠没指教
...全文
评论 4
收藏 已收藏
分享
返回顶部
hhitjsj021
基础编程 21,889 成员 140,329 内容