SQLSTATE[HY000]: General error:1366 Incorrect string value: ' \xe4\xb8\x8a\xe5\xae\x98 ... ' for column ' content ' at row 1
Mysqld version:5.6
Character set to Utf-8
Later, based on this post: http://drupal.stackexchange.com/questions/88327/ Pdoexception-sqlstatehy000-general-error-1366-incorrect-string-value-wh
The suspicion is that the Utf-8 supported character set in MySQL is limited, so it's changed to UTF8MB4, but it doesn't solve the problem.
Help you heroes.
Reply content:
SQLSTATE[HY000]: General error:1366 Incorrect string value: ' \xe4\xb8\x8a\xe5\xae\x98 ... ' for column ' content ' at row 1
Mysqld version:5.6
Character set to Utf-8
Later, based on this post: http://drupal.stackexchange.com/questions/88327/ Pdoexception-sqlstatehy000-general-error-1366-incorrect-string-value-wh
The suspicion is that the Utf-8 supported character set in MySQL is limited, so it's changed to UTF8MB4, but it doesn't solve the problem.
Help you heroes.
Because the PDO is used, and the SQL statement is longer. The SQL statement was not posted.
The original PHP statement is: BookArticle::create(array('title' => $title, 'content' => $article_content, 'book_id' => $book->id, 'spider_url' => $url));
I use the laravel framework.
When executing the error:
SQLSTATE[HY000]: General error:1366 Incorrect string value: ' \xe4\xb8\x8a\xe5\xae\x98 ... ' for column ' content ' at row 1
I try to clean UTF8 code, still can't insert.
Then I just want to print out SQL and execute it in phpMyAdmin.
$sql = "insert into book_articles set title='$title',content='$article_content',book_id=$book_id";
The error message in phpMyAdmin is data too long for text ...
Change the text to longtext problem solving.
Problem solved a bit slow for two reasons
The error message given in 1,PDO is not accurate enough.
2, there are several articles collected but there are coding problems, this problem is too interesting to attract attention.
Paste SQL (Word patch)