Jump to content


Get element list with a specific id

query database mysql

  • Please log in to reply
No replies to this topic

#1 jospalgal

jospalgal

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 08 May 2017 - 09:54 AM

For example, i have two tables ('intervalosHorarios' and 'entregas' [1_n]) and i want to show 'entregas' list from specific 'intervalosHorarios' id. I tried the following but it didn't work.

 

2O8B7.png

 

 

**Controller**

 

public function entregas_lista($idCarga) {

$crud = new grocery_CRUD();

$datos = array(
'title' => "entregas", // En la vista 'header' tendré una variable $title
'username' => "Administrador"
);

$this->load->view('commons/header', $datos);

//Quitamos los botones de añadir y quitar
$crud->unset_add();
$crud->unset_edit();

$crud->set_language("spanish");
$crud->set_theme('bootstrap');
$crud->set_table('entregas');



$crud->where('idCarga =', $idCarga);



$crud->display_as('idCarga', 'Nº Entrega');
$crud->set_subject('Carga / Descarga');
$crud->set_relation('idCarga', 'intervalosHorarios', 'intervaloHorario');

$crud->columns('fechaCita', 'horaCita', 'numeroEntrega', 'cliente', 'Origen', 'Destino', 'cargaPrevista', 'entregaPrevista', 'accion', 'estado');




$output = $crud->render();




$this->_example_output($output);


//--------------- Cargo la vista 'commons/footer.php' ------------- /
$this->load->view('commons/footer');
}


function _example_output($output = null) {
$this->load->view('example', (array) $output);
}

 







Also tagged with one or more of these keywords: query, database, mysql

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users