使用mysql在cakephp中进行多重编辑

使用mysql在cakephp中进行多重编辑,cakephp,Cakephp,Hii我正在尝试在单个表中进行多个更新 下面我将描述控制器、视图编码 内部控制器 public function multiEdit($oid,$cid){ $this->set('oid',$oid); $this->set('cid',$cid); $this->set('oid',$oid); $this->set('cid',$cid); $item = $this->Item->find('all',array('condi

Hii我正在尝试在单个表中进行多个更新 下面我将描述控制器、视图编码

内部控制器

public function multiEdit($oid,$cid){
  $this->set('oid',$oid);
  $this->set('cid',$cid);


  $this->set('oid',$oid);
  $this->set('cid',$cid);

  $item = $this->Item->find('all',array('conditions' => array('Item.order_id' => $oid,'Item.visible'=>true)));

    if($this->request->is('post') || $this->request->is('put')){

        if($this->Item->saveAll($this->data)){

            $this->Session->setFlash('Item Information has been updated',true);
            $this->redirect(array('action' =>'index',$oid,$cid));
        }else{
            $this->Session->setFlash('Unable to update Item information',true);
        }
    }

    if(!$this->request->data){
        $this->request->data = $item;
    }

}
鉴于

<?php echo $this->Form->create('Item');?>
<?php foreach ($this->data as $i => $item): ?> 
<?php

echo $this->Form->hidden("Item.$i.id", array('value' => $item['Item']['id']));
echo $this->Form->input("Item.$i.name", array('value' => $item['Item']['name']));
echo $this->Form->hidden("Item.$i.code", array('value' => $item['Item']['code']));
echo $this->Form->hidden("Item.$i.qnty", array('value' => $item['Item']['qnty']));
echo $this->Form->hidden("Item.$i.price", array('value' => $item['Item']['price']));
echo $this->Form->input("Item.$i.sent", array('value' => $item['Item']['sent']));
echo $this->Form->hidden("Item.$i.ac_sent", array('value' => $item['Item']['ac_sent']));
echo $this->Form->hidden("Item.$i.visible", array('value' => $item['Item']['visible']));?

<?php  endforeach; echo $this->Form->end('Save Item') ?>


尝试使用updateAll进行多次更新updateAll导致我出现数据库错误我正在使用$this->Item->updateAll($this->request->data)检查此链接的格式是否正确。卡蒂纳山。。。。我会努力寻找我的问题。。。。。。。。。为了给您宝贵的时间,我再次使用saveMany Thanxx解决了我的问题