Jump to content


set_relation_n_n - retrieve information from another table

set_relation_n_n table

  • Please log in to reply
No replies to this topic

#1 lraifort

lraifort

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 22 November 2019 - 01:37 PM

hello,

 

i have some difficulties to find the solution to solve my problem.

i am using set_relation_n_n function between tables registration (inscriptions), and financial transaction (transact).

One financial transaction can address one or more registration, transact_inscription is the relation table

It is working fine but instead of showing member id (adherents_id) , i would like to show the member name (nom) ,  information stored into table adherents

How can i manage it ?

My code below. i attached ERD diagram

Many thanks for your help.

 

 

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Transactions extends CI_Controller {

function __construct()
{
         parent::__construct();

         /* Standard Libraries of codeigniter are required */
         $this->load->database();
         $this->load->helper('url');
         /* ------------------ */

         $this->load->library('grocery_CRUD');

}

public function show()
{
        $crud = new grocery_CRUD();
        $crud->set_theme('flexigrid');
        $crud->set_table('transact');
        $crud->set_relation_n_n('adherent','transact_inscription','inscriptions','transact_id','inscription_id','{adherents_id} {cotisation}', 'priority');

        $output = $crud->render();

        $this->_example_output($output);
}

function _example_output($output = null)
{

        $this->template->set('title', 'Gestion des Transactions');
        // on charge la page dans le template
        $this->template->load('template', 'transactions', $output);
}
}

 

 

 

Attached Thumbnails

  • screenshot.jpg

Attached Files







Also tagged with one or more of these keywords: set_relation_n_n, table

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users