Yii Framework Forum: $Model->Save - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

$Model->Save $model->save

#1 User is offline   hshfcb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 12-August 13

Posted 28 October 2013 - 06:44 AM

من میخوام همه همه ارایم سیو کنم اما تو کد زیر فقط یکیش سیو میشه...
foreach($nowjob as $value)
{
echo" $value<br />";
$model21->NJ_id = $value;
$model21->NW_id = '27';
$model21->save();

}
0

#2 User is offline   Behnaz 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 05-December 12
  • Location:Iran

Posted 28 October 2013 - 08:36 AM

View Posthshfcb, on 28 October 2013 - 06:44 AM, said:

من میخوام همه همه ارایم سیو کنم اما تو کد زیر فقط یکیش سیو میشه...
foreach($nowjob as $value)
{
echo" $value<br />";
$model21->NJ_id = $value;
$model21->NW_id = '27';
$model21->save();

}


این درسته :

foreach ($newjob as $value){

echo" $value<br />";
$model21 = new YourModelName;
$model21->NJ_id = $value;
$model21->NW_id = '27';
$model21->save();
}
0

#3 User is offline   hshfcb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 12-August 13

Posted 03 November 2013 - 01:29 AM

View PostBehnaz, on 28 October 2013 - 08:36 AM, said:

این درسته :

foreach ($newjob as $value){

echo" $value<br />";
$model21 = new YourModelName;
$model21->NJ_id = $value;
$model21->NW_id = '27';
$model21->save();
}

thank you :D
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users