Welcome Guest, Not a member yet? Register   Sign In
Outputting data problem
#1

[eluser]skribe[/eluser]
Hi folks:

I'm adapting this CRUD example and I'm having some difficulties trying to determine how to output my data. Basically what it should do is output the contact details of a person which are held in three tables

Person:
id
name

Contact_Type:
id
type

Person_contact (join):
person_id
contact_type_id
details

Contact type allows me to add different ways to contact people (email, phone, european swallows). Details holds the actual address.

These are the additions. They're producing a Message: Undefined property: CI_DB_mysql_result error

Controller:
Code:
function view($id){

        // get person details
        $data['contact'] = $this->person_model->get_person_contact($id);
        // load view
        $this->load->view('personview', $data);
    }

Model:
Code:
function get_person_contact($id){
        $this->db->select('ct.type, pc.details');
        $this->db->from('person_contact pc');
        $this->db->where('pc.person_id', '$id');
        $this->db->join('contact_type ct', 'pc.contact_id = ct.id');
        $data['query']= $this->db->get();
        return $data;
}

View:
Code:
<?php foreach ($contact as $contact){ ?>
                <tr>
                    <td valign="top">&lt;?php echo "$contact->contact_type.type" ?&gt;</td>
                    <td>&lt;?php echo $contact->person_contact.details ?&gt;</td>
                </tr>
            &lt;?php } ?&gt;

Any suggestions?


Messages In This Thread
Outputting data problem - by El Forum - 12-27-2010, 12:24 AM
Outputting data problem - by El Forum - 12-27-2010, 03:19 AM
Outputting data problem - by El Forum - 12-27-2010, 07:52 PM
Outputting data problem - by El Forum - 12-27-2010, 09:32 PM
Outputting data problem - by El Forum - 12-27-2010, 10:03 PM
Outputting data problem - by El Forum - 12-27-2010, 10:58 PM
Outputting data problem - by El Forum - 12-27-2010, 11:32 PM
Outputting data problem - by El Forum - 12-27-2010, 11:53 PM
Outputting data problem - by El Forum - 12-28-2010, 12:02 AM
Outputting data problem - by El Forum - 12-28-2010, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB