Welcome Guest, Not a member yet? Register   Sign In
Need help returning single row from database
#11

[eluser]blinger2008[/eluser]
i thought that's what it was, i will try that. thanks
#12

[eluser]blinger2008[/eluser]
when i load the view without the print_r, it says no records returned. but i am passing the $person variable

Code:
function person(){
        $data = array();
        
        if($this->uri->segment(3)) {
        $person=$this->people_model->get_record($this->uri->segment(3));

        $this->load->view('content/person', $person);
        //print_r($person);
        //die();
        } else {
        if($query = $this->people_model->get_record()){
            $data['records'] = $query;
            }
    }
        
        
        }
#13

[eluser]JHackamack[/eluser]
because $person is a row and a single array. where in your view you're looking for an array of multiple arrays. You can change $person = $this to $data['records'] = $this and in the get_record change the ->row() to ->result()
#14

[eluser]blinger2008[/eluser]
that worked. thank you so much!




Theme © iAndrew 2016 - Forum software by © MyBB