Welcome Guest, Not a member yet? Register   Sign In
Message: Undefined variable
#1

[eluser]webdude[/eluser]
I am receiving an undefined variable error message on line 18 which is $list .= $row['parent_navigation_title'].",";

Any ideas?

Code:
class Blog extends Controller {
    
        function Blog()
        {
            parent::Controller();
        }
    
        function index()
        {

            $this->load->helper('html');
            $query = $this->db->query("select navigation_title as parent_navigation_title from pages where parent_id = 0");
        
            foreach ($query->result_array() as $row)
            {
                 $list.= $row['parent_navigation_title'].",";
            }
        
            $data['nav_list']= ul(split(",", substr_replace($list ,"",-1)));
            $this->load->view('blog_view', $data);

        }
    }

Thanks
#2

[eluser]chobo[/eluser]
This is just a guess, but it might be the $list.= part. The first time through $line is not defined, so above the loop add $list ='';
#3

[eluser]webdude[/eluser]
yea your right. i needed to add $list = ""; i had removed it from my code before doh!!

thanks




Theme © iAndrew 2016 - Forum software by © MyBB