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

[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!
#2

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

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

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

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

yup. thanks.




Theme © iAndrew 2016 - Forum software by © MyBB