You're quite right! Thanks!!

Cheers!

Grzegorz Pawlik wrote:
You could generate a multiple insert query like that:

INSERT INTO 'some_table'(field1, field2) VALUES
('value1', 'value2'),
('value3', 'value3'), (...)

And execute it by $this->SomeModel->query();

cheers!


On Jul 26, 4:21 pm, Femi Taiwo <[EMAIL PROTECTED]> wrote:
  
Hi,
Question Summary: Is there a way to insert multiple rows into just one
table without using a for...loop or something similar?

I need to insert about several new rows into a table.
By using a loop I use something similar to what I've written below

<code>
<?php
.....
foreach($largeData as $currentData){

    $this->Classperiod->create($currentData);
    $this->Classperiod->save($currentData);}

.......
?>
</code>
Is there a better way? When I need to insert say 100 rows, that could
really cause a overhead since it will probably run 100rows x 2 queries
to do that. Any ideas?

Thanks

Femi T
    




  


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to