doulu6314 2017-01-07 05:58
浏览 91
已采纳

使用saveField函数或cakephp中的其他函数插入多个值

I insert multiple values into my database using saveField function. Here is my code.

$this->Fuel->saveField(
    'device_id',    $int_fuel_func[0],
    'func_code',    $int_fuel_func[1],
    'device_data',  $int_fuel_func[2]
);

It's not a form value. Value automatically insert when the page is refreshed.

It's only inserts first value 'device_id', $int_fuel_func[0],. Other two values are not insert into my database. Any one suggest me how to insert these values.

Thanks in advance

Cake version 2.7.5

  • 写回答

3条回答 默认 最新

  • duanhao4909 2017-01-07 10:41
    关注

    My id is not auto Increment it is defined as varchar. Time is not include there also. I got my answer. I use it and it works.

    $this->Fuel->set(
        array(
            'device_id'   => $int_fuel_value[0],
            'func_code'   => $int_fuel_value[1],
            'device_data' => $int_fuel_value[2]
        )
    );
    $this->Fuel->save();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题