How do I add more than one row with Zend_Db?

前端 未结 6 861
暗喜
暗喜 2020-12-08 07:57

I have an array with information which looks more or less like this:

$data[] = array(\'content\'=>\'asd\');
$data[] = array(\'content\'=>\'asdf\');
         


        
6条回答
  •  时光说笑
    2020-12-08 09:03

    If you do use ZF2 then solution might be like this:

    $insert = $this->getSql()->insert();
    foreach ($values as $value) {
        $relation = array(
            'column_one' => $value,
            'column_two' => $value
        );
        $insert->values($relation, Insert::VALUES_MERGE);
    }
    
    $insertRes = $this->executeInsert($insert);
    

提交回复
热议问题