Welcome Guest, Not a member yet? Register   Sign In
Processing a Database Query
#8

[eluser]CodyyC[/eluser]
Okay, I have made some progress. I am now only having trouble with the loop in the view. The array is being passed to the controller, with fields accessible by $query['field'] etc.

Here is the controller:
Code:
<?php

class Message extends Controller {
    
    function load_message_store_model(){
        $this->load->model('Message_store_m', '', TRUE);
        $this->Message_store_m->message_store();
    }
    
    function load_message_read_model(){
        $this->load->model('Message_read_m', '', TRUE);
        $formatted_data = $this->Message_read_m->message_read();
        foreach ($formatted_data->result_array() as $row)
        {
            echo $row['message'];
            
        }    
        $formatted_data = $this->load->view('message_view', $formatted_data, TRUE);
        //for debugging insert:

        // end insert
        $this->load->view('home', $formatted_data);
        return $formatted_data;
    }

}

?>


and the view:
Code:
<?php
foreach ($formatted_data as $returned_messages)
{
?>
<p class="message">
    <span class="timestamp">&lt;?php echo $timestamp;?&gt;</span>
    <span class="username">&lt;?php echo $username;?&gt;</span>
    &lt;?php echo $message?&gt;
</p>
&lt;?php
}
?&gt;

Help would be appreciated Smile


Messages In This Thread
Processing a Database Query - by El Forum - 10-03-2010, 12:18 AM
Processing a Database Query - by El Forum - 10-03-2010, 12:41 AM
Processing a Database Query - by El Forum - 10-03-2010, 12:50 AM
Processing a Database Query - by El Forum - 10-03-2010, 01:27 AM
Processing a Database Query - by El Forum - 10-03-2010, 01:44 AM
Processing a Database Query - by El Forum - 10-03-2010, 01:51 AM
Processing a Database Query - by El Forum - 10-03-2010, 02:12 AM
Processing a Database Query - by El Forum - 10-03-2010, 04:07 AM
Processing a Database Query - by El Forum - 10-03-2010, 05:33 AM
Processing a Database Query - by El Forum - 10-03-2010, 04:20 PM
Processing a Database Query - by El Forum - 10-04-2010, 08:14 AM
Processing a Database Query - by El Forum - 10-04-2010, 12:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB