У меня проблема. как мы используем update_batch() в контроллере с несколькими данными. я хочу обновить свои данные в поле eta (введите дату с name = "tgl[]" и lokasi_order (введите select-опцию с name = "chk[]")
вот мой контроллер/функция:
public function proses_order_action($lenght){
$input = $this->input->post(NULL, TRUE);
$get_cek = $this->input->post('chk', TRUE);// get all code 1 or 3 from each data to array
$get_tgl = $this->input->post('tgl', TRUE);
$i=0;
$data = while ($i < $lenght) {
array('lokasi_order' => $get_cek[$i], 'eta' => $get_tgl[$i]);
/*echo $get_cek[$i];
echo " ";
echo $get_tgl[$i];
echo "<br/>";*/
$i++;
};
/*echo $get_cek[0];
echo "</br>";
echo $get_tgl[0];
$data = array(
while ( $i <= $lenght) {
//array('lokasi_order' => $get_cek[$i], 'eta' => $get_tgl[$i]);
$i++;
}
);*/
$this->db->update_batch('detail_estimasi', $data);
}
Вот мой взгляд:
<section class = "content">
<div class = "container-fluid">
<!-- Exportable Table -->
<div class = "row clearfix">
<div class = "col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class = "card">
<div class = "header">
<h2>
Proses Order
</h2>
</div>
<style type = "text/css">
/*hilangkan exportable dan menyisakan input search di tabel*/
.dt-buttons {
display: none;
}
</style>
<div class = "body">
<div class = "table-responsive">
<?php $y=1; ?>
<form method = "POST" action = "">
<table class = "table table-bordered table-striped table-hover">
<tbody>
<tr>
<th>No.</th>
<th style = "text-align: center;">Nama Barang</th>
<th style = "text-align: center;">Nama Customer</th>
<th style = "text-align: center;">No. Polisi</th>
<th style = "text-align: center;">Kode Lokasi</th>
<th style = "text-align: center;">Estimation Time Arrived</th>
</tr>
<?php
$i = 1;
$count = 0;
foreach($data as $x){
?>
<tr>
<td style = "text-align: center;"><?= $i++ ?></td>
<td style = "text-align: center;"><?= $x->nama_item ?></td>
<td style = "text-align: center;"><?= $x->nama_lengkap ?></td>
<td style = "text-align: center;"><?= $x->no_polisi ?></td>
<td style = "text-align: center;">
<select class = "form-control show-tick" name = "chk[]">
<option value = "1">Kode 1</option>
<option value = "3">Kode 3</option>
</select>
</td>
<td style = "text-align: center;">
<input type = "date" name = "tgl[]">
</td>
</tr>
<?php $count++;} ?>
</tbody>
</table>
<input type = "submit" formaction = "<?= base_url('partsman/proses_order_action/'.$count) ?>" name = "" class = "btn btn-warning waves-effect" value = "Order">
</form>
</div>
</div>
</div>
</div>
</div>
<!-- #END# Exportable Table -->
<!-- Exportable Table -->
</div>
Вот мой захват вида:

Я хочу обновить свои данные.






public function proses_order_action()
{
$input = $this->input->post(NULL, TRUE);
$get_cek = $this->input->post('chk', TRUE);
$get_tgl = $this->input->post('tgl', TRUE);
foreach($get_cek as $cek)
{
$data['lokasi_order']= $cek;
}
foreach($get_tgl as $tgl)
{
$data['eta'] =$t;
}
$this->db->update_batch('detail_estimasi', $data);
}
я получил некоторую ошибку с этим
не могли бы вы сказать мне, какая ошибка возникает
Вы должны указать индекс для сопоставления для пакетных обновлений. это сообщение об ошибке. я добавил один параметр в свой update_batch?
я сделал с моей проблемой :) Спасибо. ваше решение открыто для меня, хе-хе-хе: D
спасибо, я стараюсь :)