I have problem with my code when i'm trying to save multiple data into database at the same time, this is my code to save into database:
foreach ($data as $value) {
$model->route = $value[0][1];
$model->begin_point = $value[0][2];
$model->begin_point = $value[0][3];
$model->save();
}
return $this->redirect('index');
every i'm trying to save, i'm only get the last data array can save into database. could someone help me? or if someone could provide a tutorial, that would be a real help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…