遇到PHP错误严重性:通知消息:数组到字符串转换文件名:mysql / mysql_driver.php行号:552

时间:2014-04-14 09:02:49

标签: codeigniter codeigniter-2 code-injection codeigniter-datamapper

型号:

function trans_gdc_add()
    {
$trans_gdc_gc_package[0] = $this->input->post('trans_gdc_gc_package');
$trans_gdc_gc_package1 = implode(",", $trans_gdc_gc_package[0]);
        $add=array(
                    'trans_gdc_no' => $this->input->post('trans_gdc_no'),
             'trans_gdc_to' => $this->input->post('trans_gdc_to'),
             'trans_gdc_vehicle_no' => $this->input->post('trans_gdc_vehicle_no'),
             'trans_gdc_vehicle_type' => $this->input->post('trans_gdc_vehicle_type'),
             'trans_gdc_vehicle_chas' => $this->input->post('trans_gdc_vehicle_chas'),
             'trans_gdc_vehicle_make' => $this->input->post('trans_gdc_vehicle_make'),
             'trans_gdc_vehicle_eng' => $this->input->post('trans_gdc_vehicle_eng'),
             'trans_gdc_vehicle_permit' => $this->input->post('trans_gdc_vehicle_permit'),
             'trans_gdc_vehicle_pol' => $this->input->post('trans_gdc_vehicle_pol'),
             'trans_gdc_vehicle_isby' => $this->input->post('trans_gdc_vehicle_isby'),
             '  trans_gdc_date' => $this->input->post(' trans_gdc_date'),
             'trans_gdc_from' => $this->input->post('trans_gdc_from'),
             'trans_gdc_driver_add' => $this->input->post('trans_gdc_driver_add'), 
            'trans_gdc_lic_no' => $this->input->post('trans_gdc_lic_no'),
             'trans_gdc_vehilce_owner_name' => $this->input->post('trans_gdc_vehilce_owner_name'),
             'trans_gdc_vehicle_owner_add' => $this->input->post('trans_gdc_vehicle_owner_add'),
             'trans_gdc_vehicle_owner_mob' => $this->input->post('trans_gdc_vehicle_owner_mob'),
               'trans_gdc_broker_name' => $this->input->post('trans_gdc_broker_name'), 
               'trans_gdc_broker_mob' => $this->input->post('trans_gdc_broker_mob'), 
               'trans_gdc_gc_no' => $this->input->post('trans_gdc_gc_no'), 
               'trans_gdc_gc_package' => $trans_gdc_gc_package1, 
               'trans_gdc_gc_cont' => $this->input->post('trans_gdc_gc_cont'), 
               'trans_gdc_gc_weight' => $this->input->post('trans_gdc_gc_weight'), 
               'trans_gdc_gc_freight' => $this->input->post('trans_gdc_gc_freight'), 
             'trans_gdc_gc_consignor' => $this->input->post('trans_gdc_gc_consignor'), 
             'trans_gdc_gc_consignee' => $this->input->post('trans_gdc_gc_consignee'), 
                                   'status' => '1'
        );
        return $this->db->insert('trans_gc_add',$add);


    }
  

遇到PHP错误

     

严重性:注意

     

消息:数组到字符串转换

     

文件名:mysql / mysql_driver.php

     

行号:552

请帮我解决此问题。

2 个答案:

答案 0 :(得分:0)

检查这个

'  trans_gdc_date' => $this->input->post(' trans_gdc_date'),

空间可能会出现问题,重播

'trans_gdc_date' => $this->input->post(' trans_gdc_date'),

答案 1 :(得分:0)

您无法直接合并数组中的字符串!

你试图将concatinate字符串与数组合并,或者说使用不可能的字符串数组

一般示例

<?php
$stack = array("Orange", "Banane");
array_push($stack, "Apfel", "Himbeere");
print_r($stack);
?>

代码示例

      // array push tiggers a php array as stack!
        $add=array()
        array_push($add, 'trans_gdc_no', $this->input->post('trans_gdc_no'));
        array_push($add, 'trans_gdc_to', $this->input->post('trans_gdc_to'));
        print_r($add);