php - laravel5.3 在 mysql5.1中运行出错 error: 1366 Incorrect integer
PHP中文网
PHP中文网 2017-04-11 10:27:56
0
0
364

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过滤导致的双重引号问题

PHP中文网
PHP中文网

认证0级讲师

모든 응답(0)
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!