Welcome Guest, Not a member yet? Register   Sign In
Trying to join tables to display the author of blog entry
#1

[eluser]Brad Morse[/eluser]
I am trying to add more to the blog tutorial.

Here is the blog view:

Code:
<?php foreach($query->result() as $row): ?>
    <h2>&lt;?=$row->title?&gt;</h2>
    &lt;?php
        $body_text = $row->body;
        print character_limiter($body_text, 210);
    ?&gt;
    <p>Author: &lt;?=$row->author_id?&gt;</p>
    <p>&lt;?=anchor('blog/more/'.$row->id, 'Read on');?&gt;</p>
    <p>&lt;?=anchor('blog/comments/'.$row->id, 'Comments');?&gt;</p>
    <hr>
&lt;?php endforeach; ?&gt;

It displays the author id for now (entries.author_id = authors.id), I want it to display the author first (authors.first_name) and last name (authors.last_name). Could you please help me?

Here is the blog controller:

Code:
function index() {

    $data['title'] = "My Blog Title";
    $data['heading'] = "My Blog Heading";
    $data['query'] = $this->db->get('entries');
    
    $this->load->view('blog_view', $data);
}


Messages In This Thread
Trying to join tables to display the author of blog entry - by El Forum - 12-11-2008, 09:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB