Welcome Guest, Not a member yet? Register   Sign In
new to ci, worked before but doesnt now, following blog tutorial

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:


class Collectives extends Controller {

    function index() {
    $data['query'] = $this->db->get('registration');

the view:
<?php foreach($query->result() as $row): ?>
            <div class="results">
                <div class="collective">&lt;?=$row->collective_name?&gt;</div>
                <div class="owner">&lt;?=$row->owner_name?&gt;</div>
                    &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 />
&lt;?php endforeach; ?&gt;

can somebody help me figure out what im doing wrong?


You need to pass the data.

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

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

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

yup. thanks.

Theme © iAndrew 2016 - Forum software by © MyBB