for ( ) {
$this->attributes = $pin;
$this->save();
}
hi, this is not working T______T
it will only save one record… other will update…
for ( ) {
$this->attributes = $pin;
$this->save();
}
hi, this is not working T______T
it will only save one record… other will update…
you have to create a new model in the for-loop
are model must loop?? like
$model[$i]=new Model;
I have tried it is usefull.
If you don’t want to repeat this:
$model = new foobar;
$model->attributes=$_POST['foobar'];
........
Use (assuming your primary key is automatically generated by auto-increment) :
while ($loop!=false) {
$model->setIsNewRecord(true);
$model->setPrimaryKey(NULL);
//then
$model->save(false);
}
It was worked for me
Thanks. It was a life saver. Cheers.