KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to display data from both the users table and users_profiles table in one HTML table. I want to link table records so that usrID = usrID . There is a one-to-one relationship between the rows in these tables. Originally, I was only fetching users_profiles records from my controller and it worked great. Controller: $data['query'] = $this->db->query('SELECT * FROM users_profiles'); $this->load->view('users/users_view',$data); View: <?php foreach($query->result_array() as $row): ?> <tr class="even gradeC"> <td><?php echo $row['usrID']</td> <td><?php echo $row['usrName'];?></td> </tr> <? endforeach; ?> Here is my new, flawed coding attempt using query builder: $this->db->select('users.usrID, users_profiles.usrpID'); $this->db->from('users', 'users_profiles'); $this->db->join('users', 'users.usrID = users_profiles.usrpID'); $result = $this->db->get(); Unfortunately, my query builder script is emitting an error. A Database Error Occurred Error Number: 1054 Unknown column 'users_profiles.usrpID' in 'on clause' How should this be fixed? users table columns usrID usrName usrPassword rolelD usrRegDate usrRegIP usrStatus usrLoginlP usrLoginDate usrLogins usrValidationCode usrPhoto
Tags (comma-separated)
Save Edits
Cancel