Welcome Guest, Not a member yet? Register   Sign In
Missing variables in my view
#1

[eluser]Unknown[/eluser]
Good evening,

I have a fairly complicated page that calls a header, some smaller views that form a list, and then a footer. One of the variables that I am trying to pass through to each list element is missing entirely (variable does not even exist).

The data exists on the controller side, I can echo it to the browser, and all of the other data in the array that I am passing to the view gets there fine, except this one element.

My question is, is there an upper limit to the amount of data one can pass? (this would make no sense, as the missing element should be the first one in the array)

Alternatively, I pass some other data to the header (not the same names or anything) could it be interfering?

Perhaps someone could give me an idea as to how to trace this issue? (what files hold the code I should be looking at, etc)

Here is the offending controller:
Code:
function projView($projectCategoryID, $page)
    {
        if($this->session->userdata("userName") == "")
        {
            $data['title'] = 'Not Logged In';

            $this->load->view('header', $data);

            $this->load->view('loginRequired');

            $this->load->view('footer');
        }
        else
        {
            $data['title'] = 'Projects View';
            $data['userName'] = $this->session->userdata('userName');

            $this->load->view('header', $data);

            $query = '';
            $numquery = '';
            if($projectCategoryID=='my' && $this->session->userdata('isCustomer') == chr(0x01))
            {
                $query = $this->db->query('select * from project where userID=? and deleted <> 1 order by postdate desc limit ?,10;', array($this->session->userdata('userID'), ($page)*10));
                $numquery = $this->db->query('select * from project where userID=? and deleted <> 1;', array($this->session->userdata('userID')));
            }
            else if($projectCategoryID=='my' && $this->session->userdata('isEngComp') == chr(0x01))
            {
                $query = $this->db->query('select * from project where projectID in(select projectID from purchasedProjects where userID=?) and deleted <> 1 order by postdate desc limit ?,10;', array($this->session->userdata('userID'), ($page)*10));
                $numquery = $this->db->query('select * from project where projectID in(select projectID from purchasedProjects where userID=?) and deleted <> 1;', array($this->session->userdata('userID')));
            }
            else if($projectCategoryID=='all')
            {
                $query = $this->db->query('select * from project where deleted <> 1 order by postdate desc limit ?,10;', array(($page)*10));
                $numquery = $this->db->query('select * from project where deleted <> 1');
            }
            else
            {
                $query = $this->db->query('select * from project where projectTypeID=? and deleted <> 1 order by postdate desc limit ?,10;', array($projectCategoryID, ($page)*10));
                $numquery = $this->db->query('select * from project where projectTypeID=? and deleted <> 1;', array($projectCategoryID));
            }
            
            $numresults = $numquery->num_rows(); //this is for page numbering.

            foreach ($query->result() as $row)
            {
                $imgquery = $this->db->query('SELECT * from file where projectID=? and fileTypeID=1 order by uploadDate desc', array($row->projectID));
                
                if ($imgquery->num_rows() > 0)
                {
                    $imgrow = $imgquery->row();
                    
                    $rowdata['imageFileName'] = $imgrow->thumbFileName;
                }
                else
                {
                    $rowdata['imageFileName'] = 'noimage.jpg';
                }
                
                //if an engineering company has purchased this project
                $purchasedquery = $this->db->query('SELECT * from purchasedProjects where projectID=? and userID=?', array($row->projectID, $this->session->userdata('userID')));
                if ($purchasedquery->num_rows() > 0)
                {
                    $rowData['purchased'] = 1;
                }
                else
                {
                    $rowData['purchased'] = -1;
                }
                
                $rowData['userID'] = $this->session->userdata("userID");
                $rowData['projectUserID'] = $row->userID;
                $rowData['projectID'] = $row->projectID;
                $rowData['postDate'] = $row->postDate;
                $rowData['projArea'] = $row->areaID;
                $rowData['description'] = $row->description;
                
                $this->load->view('project', $rowData);
            }

            $query = $this->db->query('SELECT count(*) as itemcount FROM project where projectTypeID=?', array($projectCategoryID));
            $row = $query->row();
            
            $pagedata['numpages']=ceil($numresults/10);
            $pagedata['pagenumber']=$page;
            $pagedata['projectCategoryID']=$projectCategoryID;
            
            $this->load->view('pageFooter', $pagedata);
            
            $this->load->view('footer');
        }
    }

The issue is $rowdata['imageFileName'] It is set in this function, and then does not appear in the view at all. My apologies for the wall of code, but I'm out of ideas here.

Thanks to anyone willing to sift through this with me.
#2

[eluser]Dyllon[/eluser]
Variables are case sensitive
#3

[eluser]Unknown[/eluser]
oh man. biggest facepalm ever here. Thank you so much.




Theme © iAndrew 2016 - Forum software by © MyBB