Troubleshooting of MySQL errors: Difference between revisions

Jump to navigation Jump to search
Line 397: Line 397:
* [[SQL syntax debug]]
* [[SQL syntax debug]]
* [https://www.eversql.com/sql-syntax-check-validator/ SQL Syntax Check Online, SQL Validator, Instant SQL Compiler Online – EverSQL] {{exclaim}} Not support the [https://www.php.net/manual/en/pdo.prepare.php PHP: PDO::prepare] which the query syntax contains question marks.
* [https://www.eversql.com/sql-syntax-check-validator/ SQL Syntax Check Online, SQL Validator, Instant SQL Compiler Online – EverSQL] {{exclaim}} Not support the [https://www.php.net/manual/en/pdo.prepare.php PHP: PDO::prepare] which the query syntax contains question marks.
=== ERROR 1366: Incorrect string value ===
Message: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x87\xAF\xF0\x9F...' for column 'XXX'
Solution:
* Check the charset of PHP PDO. AND execute {{kbd | key=set names utf8mb4}}<ref>[https://stackoverflow.com/questions/54947392/incorrect-string-value-when-trying-to-pass-emoji-to-the-db-encoded-with-utf8mb4 php - Incorrect string value when trying to pass emoji to the db encoded with utf8mb4 - Stack Overflow]</ref>
* Check the configuration of table
** CHARACTER SETS (aka 字元集、字符集): {{kbd | key=utf8mb4}}
** COLLATION (aka 定序、字元序): {{kbd | key=utf8mb4_unicode_ci}}


== Connection and Network Errors ==
== Connection and Network Errors ==

Navigation menu