list data from two table |
If I have in one table data in columns: id_first, name. Example:
Code: 1, Joe And in second have data in columns id_second, id_first, lastname. Example" Code: 1, 3, Basinger To get table in view likse this: Code: 1, Kim, Basinger How to write all Model, View and Controller?
In your model, use the query builder with a join statement:
PHP Code: function get_fullnames() In your controller: PHP Code: $data['records'] = $this->names_model->get_fullnames(); //assuming that your model is called 'names_model' In your view: PHP Code: foreach ($records as $record) { |
Welcome Guest, Not a member yet? Register Sign In |