Example:
If you want to save multiple records/rows into the same table.
$multipleRowData = Array(
Array('name' => 'Bob', 'phone' => "123-123-7777"),
Array('name' => 'Ann', 'phone' => "987-123-5555"),
Array('name' => 'Tom', 'phone' => "788-123-4569")
);
$this->Mymodelname->saveAll($multipleRowData);
This would result in inserting 3 rows in the "mymodelname" table.
if u set debug = 2 in core.php and look over the queries you see it insert the records multiple "insert" queries where this is wrong it should be in one single insert query like:
ReplyDelete"insert into table (field1, field2) values('row1','row1'),('row2',row2')"
works great thanks
ReplyDelete