Laravel has an error when running under MySQL5.1. The error is as follows:
<code>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)) </code>
But the PDO I wrote has no problem executing the test
<code>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(); }</code>
Data table structure:
I also checked online and it said that I changed SQL_MODE and changed it, but still got the error
The problem has been solved. It was the double quotation mark issue caused by adding Shell filter
Laravel has an error when running under MySQL5.1. The error is as follows:
<code>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)) </code>
But the PDO I wrote has no problem executing the test
<code>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(); }</code>
Data table structure:
I also checked online and it said that I changed SQL_MODE and changed it, but still got the error
The problem has been solved. It was the double quotation mark issue caused by adding Shell filter