0
으로 저장 나는 다음과 같은 기능이 있습니다기존 배열에 배열을 추가 이그나이터
function saveCOA() {
$labref = $this->uri->segment(3);
$data = $this->input->post('compedia');
$data1 = $this->input->post('specification');
count($data) == count($data1);
for ($i = 0; $i < count($data); $i++) {
$insert_data = array(
'labref' => $labref, //NDQA201303001
'compedia' => $data[$i],
'specification' => $data1[$i]
);
$this->db->insert('coa_body', $insert_data);
}
이 잘 저장하지만 아래 그림과 같이 지금은 그것을 수정 한을 : 값
$labref=$this->uri->segment(3);
$test_id= $this->getRequestedTestIds($labref);
$data = $this->input->post('compedia');
$data1 = $this->input->post('specification');
count($data) == count($data1) && count($data)== count($test_id);
for ($i = 0; $i < count($data); $i++) {
$insert_data = array(
'labref' => $labref, //NDQA201303001 - Same for all the rows
'test_id'=>$test_id[$i], //added array
'compedia' => $data[$i],
'specification' => $data1[$i]
);
$this->db->insert('coa_body', $insert_data);
}
$ test_id 같이 print_r()
의해 인쇄된다 :
Array ([0] => Array ([test_id] => 5) [1] => Array ([test_id] => 7) [2] => Array ([test_id] => 9) [3] => Array ([test_id] => 10))
I 배열추가 한이며, 다음을 반환합니다.
Error Number: 1054
Unknown column 'Array' in 'field list'
INSERT INTO `coa_body` (`labref`, `test_id`, `compedia`, `specification`) VALUES ('NDQA201303001', Array, 'Alphy', 'poxy')
Filename: C:\xampp\htdocs\NQCL\system\database\DB_driver.php
Line Number: 330
무엇이 누락 되었습니까?
고마워요, 잘 작동합니다. – alphy
안녕하세요. 프로젝트에 행운을 빈다. –