Hi All,
I have a form and on submitting the form I am trying to insert two rows in the same table. I am using ActiveRecord for this and may be because of my less knowledge I am having a problem in it.
Whenever i try to insert values it only inserts one row.
The code is given here
$model = new MachineAlarm;
$model->strAlarmName = $criteria;
$model->intAlarmUpperLimit = $alarmUpperLimit;
$model->intAlarmLowerLimit =$alarmLowerLimit;
$model->strAlarmCriteria = $criteria;
$model->strMachine_Id = $machineId;
$model->strAlarmDescription ='Maintenance';
$model->strAlarmLevel = '1';
if($model->save()){
$model->strAlarmName = $criteria;
$model->intAlarmUpperLimit = '0';
$model->intAlarmLowerLimit =$alarmUpperLimit;
$model->strAlarmCriteria = $criteria;
$model->strMachine_Id = $machineId;
$model->strAlarmDescription ='Critical';
$model->strAlarmLevel = '2';
$model->save();
As per my understanding it should insert two rows but it is inserting only one row and that too the second portion…
Any help is highly appreciated.
Regards