这是我的查询:
$query = $this->db->query('
SELECT archives.id, archives.signature, type_of_source.description, media_type.description, origin.description
FROM archives, type_of_source, media_type, origin
WHERE archives.type_of_source_id = type_of_source.id
AND type_of_source.media_type_id = media_type.id
AND archives.origin_id = origin.id
ORDER BY archives.id ASC
');
但是如何输出结果呢?这有效,但只获取最后一个描述(origin.description):
foreach ($query->result_array() as $row)
{
echo $row['description'];
}
这不起作用:
foreach ($query->result_array() as $row)
{
echo $row['type_of_source.description'];
}
或者我应该重命名列(例如 type_of_source_description)?