簡體   English   中英

無法使用php codeigniter插入批量記錄

[英]not able to insert bulk record using php codeigniter

提供此數組,我試圖使用insert_batch將其插入表中。

$arrayOfQuestions包含多個數組,如下所示:

Array
(
    [0] => Array
        (
            [question_desc] => In human beings, partial pressure of carbon dioxide in the inspired and expired air is respectively
            [option_a] => 0.3 and 40 mm Hg
            [option_b] => 0.3 and 32 mm Hg
            [option_c] => 40 and 46 mm Hg
            [option_d] => 40 and 0.3 mm Hg
            [answer] => B
            [diff_level] => 4
            [solution] => Refer answer.
            [chapter_id] => 54
            [inst_id] => 1
            [subject_id] => 68
            [ref_q_id] => 8540371983
        )

    [1] => Array
        (
            [question_desc] => At high altitude, RBCs of human blood will
            [option_a] => Increase in number
            [option_b] => Decrease in number
            [option_c] => Decrease in size
            [option_d] => Increase in size
            [answer] => A
            [diff_level] => 2
            [solution] => At higher altitudes, due to low pressure of atmospheric oxygen, the body has to carry more oxygen than normal in per volume of blood to supply the body constantly. The increased number of RBC in blood ensures the presence of more haemoglobin and thus more oxygen is carried.
            [chapter_id] => 54
            [inst_id] => 1
            [subject_id] => 68
            [ref_q_id] => 8540371983
        )
)

我在下面嘗試過的代碼中返回true ,但是數據未插入表中 ..

$result = $this->db->insert_batch('test_temp_question', $arrayOfQuestions);

成功為其插入數據使用條件:

if($result>0){
echo"successfull.";
}
else{
echo"not successfull";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM