我的观点:
<div id="forum">
<?php
if($query)
{
?>
<div class="forum_headline">Forum kategori - Forum tråde - <?php echo $query->overskrift; ?></div><!-- forum_headline -->
<div class="forum_profil_img"></div><!-- forum_profil_img -->
<div class="forum_post_content">
<span style="font-size:15px;"><?php echo anchor('profil/'.$query->brugernavn, $query->brugernavn); ?></span>
<span style="font-size:11px; margin-left:3px; color:#686868;"><i> Siger</i></span><br>
<?php echo $query->indhold;
echo "<br>ID: ".$query->id;
?>
</div><!-- forum_post_content -->
<?php
} else {
echo "Der blev ikke fundet nogen post";
}
?>
</div><!-- forum -->
我的模特
function posts($id)
{
$this->db->select('*');
$this->db->from('forum_traad');
$this->db->join('forum_kommentare', 'forum_kommentare.fk_forum_traad', 'forum_traad.id');
$this->db->where('forum_traad.id', $id);
$query = $this->db->get();
if($query->num_rows > 0)
{
return $query->row();
} else {
return false;
}
}
答案 0 :(得分:1)
您可以给他们一个不同的名字:
$this->db->select('forum_traad.indhold as traad_indhold,
forum_kommentare.indhold as kommentare_indhold');
如果您需要*的功能,您还可以选择:
$this->db->select('forum_traad.indhold as traad_indhold,
forum_kommentare.indhold as kommentare_indhold,
forum_traad.*,
forum_kommentare.*');