如何显示username?
一个消费排行榜模块:我用关联查询,(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;
}
}
新人,望大侠没指教