Welcome Guest, Not a member yet? Register   Sign In
display db data from to tables on one page
#1

[eluser]matches[/eluser]
Hello,

I am trying to load data from two tables one is being loaded in index function like so:

Code:
function index()
{
    $id = $_GET['id'];
        
    $sql = "SELECT * FROM entries WHERE id = $id";
    $data['query'] = $this->db->query($sql);        
    $this->load->view('permalink/index', $data);        
}

This gives me an error. I am guessing because of of the $this

error:
Quote:Fatal error: Using $this when not in object context in C:\xampp\htdocs\IanSeabock\system\application\controllers\permalink.php on line 35

Code:
function showComments($blogId)
{
    $sql = "SELECT * FROM comments WHERE blogId = $blogId";
    $data['query'] = $this->db->query($sql);        
    $this->load->view('permalink/index', $data2);
            
    foreach($query->result() as $commentRow):
    echo '<div class="blogEntry">';
    echo '    <h2>' . $commentRow->author . '</h2>';
    echo '    <h3>' . $commentRow->comment . '</h3>';
    echo '</div>';
    endforeach;
                            
}

Thanks for any help


Messages In This Thread
display db data from to tables on one page - by El Forum - 09-10-2008, 09:47 PM
display db data from to tables on one page - by El Forum - 09-11-2008, 12:27 PM
display db data from to tables on one page - by El Forum - 09-11-2008, 12:40 PM
display db data from to tables on one page - by El Forum - 09-11-2008, 11:01 PM
display db data from to tables on one page - by El Forum - 09-12-2008, 06:50 AM
display db data from to tables on one page - by El Forum - 09-12-2008, 06:15 PM
display db data from to tables on one page - by El Forum - 09-13-2008, 02:38 AM
display db data from to tables on one page - by El Forum - 09-13-2008, 12:55 PM
display db data from to tables on one page - by El Forum - 09-13-2008, 02:10 PM
display db data from to tables on one page - by El Forum - 09-13-2008, 08:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB