Deprecated: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in /www/wwwroot/blog_qqvbc_com/usr/plugins/Access/Access_Core.php on line 339

Deprecated: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in /www/wwwroot/blog_qqvbc_com/usr/plugins/Access/Access_Core.php on line 392

Deprecated: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in /www/wwwroot/blog_qqvbc_com/usr/plugins/Access/Access_Core.php on line 394
Yii1 用commandBuilder方法往数据表中插入多条记录 - Joyber 的博客

$builder = Yii::app()->db->schema->commandBuilder; // 创建builder对象
$command = $builder->createMultipleInsertCommand('{{umeng_message}}', array( // umeng_message为数据库表
    array(// 格式为:'字段' => '值', 不包括主键ID,一个array为一条记录
        'msg_id' => $android['data']['task_id'],
        'detail' => $android['data']['json'],
        'msg_detail_id_fk' => $detailId
    ),
    array(
        'msg_id' => $android['data']['task_id'],
        'detail' => $android['data']['json'],
        'msg_detail_id_fk' => $detailId
    ),
));
$command->execute(); // 执行成功返回true

标签: yii

添加新评论