laravel 在 mysql5.1 下运行出错 ,错误如下:
sqlstate[hy000]: general error: 1366 incorrect integer value: ''1'' for column 'status' at row 1 (sql: insert into `cases` (`case_name`, `status`, `updated_at`, `created_at`) values ('fdsafdsadsa', '1', 1474504956, 1474504956))
但是自己写的pdo执行测试却没有问题
try { $sth = $db->prepare('insert into cases(case_name,status,updated_at,created_at) values (?,?,?,?)'); $sth->bindvalue(1, '我也是中文', pdo::param_str); $sth->bindvalue(2, '1', pdo::param_int); $sth->bindvalue(3, time(), pdo::param_int); $sth->bindvalue(4, time(), pdo::param_int); $sth->execute();} catch (\exception $e){ echo $e->getmessage();}
数据表结构:
也在网上查询了说是更改sql_mode也更改过了,依然报错
问题已解决是加了shell过滤导致的双重引号问题
回复内容: laravel 在 mysql5.1 下运行出错 ,错误如下:
sqlstate[hy000]: general error: 1366 incorrect integer value: ''1'' for column 'status' at row 1 (sql: insert into `cases` (`case_name`, `status`, `updated_at`, `created_at`) values ('fdsafdsadsa', '1', 1474504956, 1474504956))
但是自己写的pdo执行测试却没有问题
try { $sth = $db->prepare('insert into cases(case_name,status,updated_at,created_at) values (?,?,?,?)'); $sth->bindvalue(1, '我也是中文', pdo::param_str); $sth->bindvalue(2, '1', pdo::param_int); $sth->bindvalue(3, time(), pdo::param_int); $sth->bindvalue(4, time(), pdo::param_int); $sth->execute();} catch (\exception $e){ echo $e->getmessage();}
数据表结构:
也在网上查询了说是更改sql_mode也更改过了,依然报错
问题已解决是加了shell过滤导致的双重引号问题