0

我搜索了网络,但没有找到任何解决我问题的方法。我有一个动态生成的表单,我获取数组中的每个字段并将其 insert_batch 到数据库中,并且以同样的方式更新_batch,

现在我想在 update_batch 期间记录我的数据库,我的数据以数组形式出现有没有办法只记录受影响的行?

这是我发送给模型以进行 update_batch 的简单代码

            $name            = $this->input->post('name');
                $type            = $this->input->post('type');
                $model           = $this->input->post('model');
                $license         = $this->input->post('license');
                $machine_no      = $this->input->post('machine_no');
                $value           = $this->input->post('value');
                $bought_date     = $this->input->post('bought_date');
                $bought_place    = $this->input->post('bought_place');
                $cur_price       = $this->input->post('cur_price');
                $bought_seller   = $this->input->post('bought_seller');
                $sfunds          = $this->input->post('sfunds');
                $u_rec_id        = $this->session->userdata('rec_id');
                $serial          = $this->session->userdata('serial');

                $all_array = array();
                $form_data = array();
                if($name)
                {
                    if(is_array($name))
                    {

                        for($j=0; $j<count($name); $j++)
                        {
                            $this->ci_form = array(
                                        'name'                    => $name[$j],
                                        'vehicle_type'            => $type[$j],
                                        'made_model'              => $model[$j],
                                        'license'                 => $license[$j],
                                        'machine_no'              => $machine_no[$j],
                                        'value'                   => $value[$j],
                                        'date_acquired'           => change_datei($bought_date[$j]),
                                        'place_acquired'          => $bought_place[$j],
                                        'current_value'           => $cur_price[$j],
                                        'seller'                  => $bought_seller[$j],
                                        'fund_source'             => $sfunds[$j],
                                        'userid'                  => $id,
                                        'u_rec_id'                => $u_rec_id,
                                        'serial'                  => $serial,
                                        'regdate'                 => date('Y-m-d H:m:s')

                              );
                              array_push($all_array, $this->ci_form);
                        }


                    }
               }
4

0 回答 0