我正在运行这个运行良好的语句....
$sql = "SELECT skill,SUM(quantity) as sum FROM skills
WHERE userid = $userid
GROUP BY skill";
我的问题是列技能存储来自表机构_技能的值,该表有一个包含技能名称的列。
我想弄清楚如何显示技能的名称而不是存储在技能表中的值?
这是我正在使用的整个代码......
<?php
defined( '_JEXEC' ) or die;
$db = JFactory::getDBO();
$user =& JFactory::getUser();
$userid = $user->get('id');
$sql = "SELECT skill,SUM(quantity) as sum FROM skills
WHERE userid = $userid
GROUP BY skill";
$db->setQuery($sql);
$rows = $db->loadObjectList();
?>
<style>
table, td, th
{
border-bottom:1px solid black;
}
{
th
background-color:#000000
color:#FFF
}
</style>
<table>
<tr>
<th width="195">Skill</th> <th width="195">Total Completed</th>
</tr>
</table>
<table>
<?PHP foreach ($rows as $row): ?>
<tr>
<td width="200"> <?php echo $row->skill?> </td>
<td width="190"> <?php echo $row->sum ?> </td>
</tr>
<?php endforeach ?>
</table>