CodeIgniter Forums
new to ci, worked before but doesnt now, following blog tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: new to ci, worked before but doesnt now, following blog tutorial (/thread-12450.html)



new to ci, worked before but doesnt now, following blog tutorial - El Forum - 10-19-2008

[eluser]slothdog[/eluser]
hey all,

new to ci, been following along with the concepts of blog tutorial to make a simple contact storing and displaying database app for personal use.

now, so far so good. ive got the form, submitting and the data storing in the right place in the database. however, when i try and follow the part of the blog tutorial for displaying the results, i get the member function on a non-object error. however, i had this exact code working last night when the function to display it was part of the contact form class in the form controller.

now i want to create a separate controller to display the results, so this is what ive got:

controller:
Code:
<?

class Collectives extends Controller {

    function index() {
    $data['query'] = $this->db->get('registration');
    $this->load->view('viewcollectives');
    }
}
?>

the view:
Code:
<?php foreach($query->result() as $row): ?>
        <p>
            <div class="results">
                <div class="collective">&lt;?=$row->collective_name?&gt;</div>
                <div class="owner">&lt;?=$row->owner_name?&gt;</div>
                <div>
                    <ul>
                    <em>
                    &lt;?=$row->collective_name?&gt;<br />          
                    &lt;?=$row->biz_address?&gt;<br />          
                    &lt;?=$row->biz_city?&gt;<br />          
                    &lt;?=$row->biz_state?&gt;<br />          
                    &lt;?=$row->biz_zip?&gt;<br />          
                    &lt;?=$row->biz_phone?&gt;<br />          
                    &lt;?=$row->biz_hours?&gt;<br />
                    </em>
                    </ul>
                </div>
                           </div>
                   </p>
    
                
&lt;?php endforeach; ?&gt;

can somebody help me figure out what im doing wrong?

thanks!


new to ci, worked before but doesnt now, following blog tutorial - El Forum - 10-19-2008

[eluser]tomcode[/eluser]
You need to pass the data.

Code:
$this->load->view('viewcollectives', $data)



new to ci, worked before but doesnt now, following blog tutorial - El Forum - 10-19-2008

[eluser]slothdog[/eluser]
[quote author="tomcode" date="1224484431"]You need to pass the data.

Code:
$this->load->view('viewcollectives', $data)
[/quote]

yup. thanks.