Php 杂货店积垢未显示添加的所有物品
我的项目中有“intervalosHorarios”和“entregas”,当我在“Intervaloshorario”上点击时,它会显示“Intervaloshorario”中的“entregas”。问题是添加更多的“entregas”,因为它只显示添加的第一个。我想让大家看看“intervaloHorario”里面的“entregas”。有什么想法吗 表格 控制器Php 杂货店积垢未显示添加的所有物品,php,codeigniter,codeigniter-3,grocery-crud,Php,Codeigniter,Codeigniter 3,Grocery Crud,我的项目中有“intervalosHorarios”和“entregas”,当我在“Intervaloshorario”上点击时,它会显示“Intervaloshorario”中的“entregas”。问题是添加更多的“entregas”,因为它只显示添加的第一个。我想让大家看看“intervaloHorario”里面的“entregas”。有什么想法吗 表格 控制器 public function entregas_lista($idCarga) { $crud = new
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('idIntervaloHorario', '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);
}
当我在'De 12:00 a 13:30'上单击时,它显示与'De 7:00 a 8:30'链接相同的行,如果我取消注释'where'子句,它显示fine(该链接的信息),但仅显示一行
区间表
交付表您正在设置
$crud->where('idCarga=',$idCarga)
我假设,$idCarga
是'Entregas'表的主键,主键是唯一的。因此,每个PK只能有一行
编辑:
$crud->where('entregas.iditervalohario=',$idCarga)代码>到每一行有“IntervalosHorarios”表FK的马赫数。谢谢您的回答!但我还是迷路了,我该怎么办?我是杂货店和php新手,请帮助。好吧,当你设置where子句时,在本例中,$crud->where()
,你的数据库将搜索一行,其中他的idCarga
与你的值集($idCarga)相同。为了避免这种情况,只需删除那段代码,或者只是注释它,然后再试一次。是的,它可以工作,但我认为我没有给出很好的解释。我只想在“intervalosHorarios”中添加clic,并在“intervalosHorarios”中显示“entregas”,这就是我使用were子句的原因。对不起,我不明白你想要什么。你能分享你想要的图片或短信吗?我已经添加了新的解释和两张图片,它们在问题的末尾。当我在'De 12:00 a 13:30'上单击时,它显示与'De 7:00 a 8:30'链接相同的行,如果我取消注释'where'子句,它将显示罚款,但仅显示一行。