update_batch не работает на модале - функция обновления - PullRequest
0 голосов
/ 06 июня 2018

В моем проекте у нас более одной ветки, и у них один и тот же тест, но у них разный ценовой рейтинг. m_fran_id - это идентификатор ветви , m_test_id - это ветка идентификатор теста , а m_updated_test_price - это цена теста для конкретного позднего завтрака.

Рекомендуется update_batch для Обновление Цена филиала.Но функция update_batch не работает.

Имя таблицы: fran_test_pricemaster

enter image description here

Контроллер

public function masterPrice_update($m_fran_id = null) 
    {
        $data['title'] = display('branch_test_dept_add');

        $sID   = $this->input->post('m_test_id');
        $sAmt  = $this->input->post('m_updated_test_price');
        $sFranId = $this->input->post('m_fran_id');

        $edited_test = array();
        for ($i=0; $i < sizeof($sID); $i++)
        {
            if(!empty($sID[$i])) 
            $edited_test[$i] = array(
                'm_test_id' => $sID[$i],
                'm_updated_test_price' => $sAmt[$i],
                'm_fran_id' => $sFranId

            );
        }
        #-------------------------------#
        if ($this->form_validation->run() === true) {
                    $this->franchise_price_model->singlebatch_Test_updt($edited_test);
                    $this->session->set_flashdata('message', display('save_successfully'));
                    redirect('branch/franchise_price/masterPrice_update');
        } else {
            $data['franceschi_list'] = $this->franceschi_model->franceschi_list();
            $data['test_Masterlist'] = $this->franchise_price_model->readTest_fromMasterPrice($m_fran_id);
            $data['content'] = $this->load->view('branch/fran_pricemasterEdit',$data,true);
            $this->load->view('layout/main_wrapper',$data);
        }
    }

Модель

public function singlebatch_Test_updt($edited_test = [])
{
    $this->db
    ->update_batch($this->fran_test_pricemaster, $edited_test , 'm_fran_id');
}

Вид

<tbody>
<tr class="<?php echo ($sl & 1)?"odd gradeX":"even gradeC" ?>">
    <td><?php echo $sl; ?></td>
    <td>
        <input type="text" name="test_name[]" class="form-control" placeholder="" value="<?php echo $subject->test_name; ?>" disabled>
        <input type="hidden" name="m_test_id[]" class="form-control" placeholder="" value="<?php echo $subject->m_test_id; ?>">
    </td>
    <td>
        <input type="text" name="test_price[]" class="form-control" placeholder="" value="<?php echo $subject->test_price; ?>" disabled>
    </td>
    <td>
        <input type="text" name="m_updated_test_price[]" class="form-control" placeholder="" value="<?php echo $subject->m_updated_test_price; ?>" id="test_priceEdt">
    </td>
</tr>

</tbody>
...