Here we are demonstrating the best way to Insert multiple rows in to a custom table with single query or at once. Sometimes we need to insert multiple records to table with a single step or query. So this way the query is efficient enough to insert multiple records at once. Multiple contacts to database will increase the load in the database server.
$data = array( array('field1' => 'value1', 'field2' => 'value2'), array('field1' => 'value3', 'field2' => 'value4'), array('field1' => 'value5', 'field2' => 'value6') ); $connection = Mage::getSingleton('core/resource')->getConnection('core_write'); $connection->insertMultiple('your-database-table', $data);