Drupal 7 PDOException:SQLSTATE [HY000]:常规错误:1366不正确的整数值

时间:2013-07-04 05:35:03

标签: drupal drupal-7

将数据插入表中的查询打破了编码流程。

如何摆脱此异常:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'annual_spend'

代码:

INSERT INTO {mc_reward_accelarators} (`nid`,`reward_type_id`,`reward_level`,          `percentage_spend`,`accelerator`,`annual_spend`,`inc_bonus_perce`,`first_year`,`language`) VALUES ('25','0','0','0','HP','','','0','en'),('25','0','0','0','FP','','','','en');

1 个答案:

答案 0 :(得分:1)

试试这个

INSERT INTO {mc_reward_accelarators} 
(
    `nid`,
    `reward_type_id`,
    `reward_level`,
    `percentage_spend`,
    `accelerator`,
    `annual_spend`,
    `inc_bonus_perce`,
    `first_year`,
    `language`
) 
VALUES 
(
    25,0,0,0,HP,,,0,en
),
(
    25,0,0,0,FP,,,,en
);

避免在值中使用(')。