[eluser]iamleeloo[/eluser]
words_db.php
<?php
class Words_db extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('words_model');
}
public function index()
{
$data['words'] = $this->words_model->get_words('restaurant'); //Get the value of "id" and "letters" of "restaurant" in table "test"
$data['title'] = 'Words';
$data['relation_mots'] = $this->words_model->get_relation_mots('restaurant'); //Get the values of "mot_2" of "mot_1=restaurant" in table "relation". They are"repas" and "resto".
$counter = 0;
foreach ($data['relation_mots'] as $relation_mots_item):
{
$data['relation_mots_id2'][$counter] = $this->words_model->get_words($relation_mots_item['mot_2']); //Get the value of "id" and "letters" of "repas" and "resto" in table "test"
$counter = $counter+1;
}
endforeach;
$data['counter'] = $counter;
$this->load->view('templates/header', $data);
$this->load->view('words_db/index', $data);
$this->load->view('templates/footer');
}
}