Hi, I want to insert multiple rows into a table at one using batch insert, I have a table "tbl_student" has three columns , "id", "name","email", i have an array that holds all the data, [ [bob, b@b.com], [mary, m@m.com], [jack, j@j.com],], now how to do it?
I have search the docs, it says
Yii::$app->db->createCommand()->batchInsert(Post::tableName(), $postModel->attributes(), $rows)->execute(); don’t know how to do it?
also below, but the data is hard-coded, how to pass the array to it to excute?
$connection ->createCommand()
->batchInsert('tbl_user', ['name', 'status'],
[
['Bala', 1],
['Akilan', 0],
['Babu', 1],
])
->execute();
thank you very much