Welcome Guest, Not a member yet? Register   Sign In
I cannot use result() or result_array() on a variable that has been passed to the vie
#1

Say I have this code.

debate.php


Code:
<?php
            $approval = $this->db->get('posts');
            foreach ($approval->result() as $approval)
            {
                echo $approval->content;
            }
            $datax = array(
                    'traffic' => $approval,
                    'nodeview_id' => "$debate[id]",
                    'avenue' => "debate",
                    'whichside' => "acceptside"
            );

            $this->load->view('_comments', $datax);
            ?> 

And inside the _comments.php view there's

Code:
<?php
foreach ($traffic->result() as $approval)
            {
                echo $approval->content;
            }
?>

What happens is that the content from the database shows in the debate.php file, but not in the _comments.php file, when it should as I'm dealing with the same variable.

What is going on?
Reply


Messages In This Thread
I cannot use result() or result_array() on a variable that has been passed to the vie - by desbest - 07-12-2017, 12:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB