Ich verwende Insert_batch < /code> in Codesigniter. < /p>
Dies ist die Foreach < /code> Schleife: < /p>
Code: Select all
foreach($add as $data){
$new_add[] = array(
'col1'=>$data['col1'],
'col2'=>$data['col2'],
'col3'=>$data['col3'],
'col4'=>$data['col4'],
'col5'=>$data['col5'],
'col6'=>$data['col6']
);
}
< /code>
Nach der Schleife ist dies das Array, das ich danach erhalten habe: < /p>
Array
(
[0] => Array
(
[col1] => col1_data
[col2] => col2_data
[col3] => col3_data
[col4] => col4_data
[col5] => col5_data
[col6] => col6_data
)
[1] => Array
(
[col1] => col1_data
[col2] => col2_data
[col3] => col3_data
[col4] => col4_data
[col5] => col5_data
[col6] => col6_data
)
)
< /code>
Batch -Abfrage einfügen: < /p>
$this->db->insert_batch('test', $new_add);
< /code>
[b] Dank dieses Kommentars habe ich das bekommen, was ich falsch mache. Kommentar [/b]
Ich habe hier einen grundlegenden Fehler gemacht. Hier möchte ich Insert_batch
< /blockquote>
Der Fehler: < /p>
Ein Php -Fehler wurde aufgenommen. Dateiname: Datenbank /db_driver.php < /p>
Zeilennummer: 1476 < /p>
Backtrace: < /p>
Datei:
D:\opt\wamp\www\yo_builder\application\controllers\Instalment.php
Line: 85 Function: insert
File: D:\opt\wamp\www\yo_builder\index.php Line: 315 Function:
require_once
< /blockquote>
Dies ist der zweite Fehler. Überprüfen Sie das Handbuch, dass
Ihrer MySQL -Serverversion für die rechte Syntax entspricht, um
in der Nähe von '0, 1) Werten (Array, Array)' in Zeile 1 < /p>
in test < /code> (0, 1) Werte (Array, Array) < /p>
< /> < /> < />