Laravel5.3 running error in mysql5.1 error: 1366 Incorrectinteger

Source: Internet
Author: User
Laravel runs in MySQL5.1 with the following error: {code ...} but there is no problem with executing the test on the PDO written by myself. {code ...} data table structure: it was also found on the Internet that the SQL _MODE has been changed, and the error is still reported. The problem is solved by adding Shell filter...

Laravel runs in MySQL5.1 with the following error:

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))

But there is no problem with executing the test on the PDO written by myself.

Try {$…… = $ db-> prepare ('Insert into cases (case_name, status, updated_at, created_at) values (?,?,?,?) '); $ Something-> bindValue (1, '', PDO: PARAM_STR); $ Something-> bindValue (2, '1', PDO :: PARAM_INT); $……-> bindValue (3, time (), PDO: PARAM_INT); $……-> bindValue (4, time (), PDO: PARAM_INT ); $ Something-> execute ();} catch (\ Exception $ e) {echo $ e-> getMessage ();}

Data table structure:

I also checked it online and said that the SQL _MODE has been changed, and an error is still returned.

The problem has been solved due to the double quotation marks caused by Shell filtering.

Reply content:

Laravel runs in MySQL5.1 with the following error:

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))

But there is no problem with executing the test on the PDO written by myself.

Try {$…… = $ db-> prepare ('Insert into cases (case_name, status, updated_at, created_at) values (?,?,?,?) '); $ Something-> bindValue (1, '', PDO: PARAM_STR); $ Something-> bindValue (2, '1', PDO :: PARAM_INT); $……-> bindValue (3, time (), PDO: PARAM_INT); $……-> bindValue (4, time (), PDO: PARAM_INT ); $ Something-> execute ();} catch (\ Exception $ e) {echo $ e-> getMessage ();}

Data table structure:

I also checked it online and said that the SQL _MODE has been changed, and an error is still returned.

The problem has been solved due to the double quotation marks caused by Shell filtering.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.