Just contact PHP, according to the example written in the book, this is the code:
Run Error: An error occurred while building the table! Invalid default value for ' sex '.
My MySQL character set is: GBK. Online Search a lot, did not succeed, so the post solution. How to modify the code, have the idea of all give a hint, thank you first!
Reply to discussion (solution)
$con =mysql_connect ("localhost", "root", "MySQL");
mysql_query ("Set names GBK");
................
Try to run
$con =mysql_connect ("localhost", "root", "MySQL");
mysql_query ("Set names GBK");
................
Try it on the run, I can't.
$con =mysql_connect ("localhost", "root", "MySQL");
mysql_query ("Set names GBK");
................
Try it on, can you run it?
Save PHP file as GBK encoding and try again
$con =mysql_connect ("localhost", "root", "MySQL");
mysql_query ("Set names GBK");
................
In the run try I manually built a table, and then made a simple registration, can register successfully. And then back to use the original code to build a table, add mysql_query ("Set names GBK"), actually succeeded, hehe ... Really strange, Baidu, Google in the morning, this method also tried to not succeed in this post, hey. It's a success, freak! It should be your lucky, thanks! I'll give you the minute.
Save PHP file as GBK encoding and then try to mention this code ha, I also got the morning, did not make, because the Save as the encoding option is not GBK ah? How did you get that?
PHP file encoding to be consistent with the MySQL database encoding, as well as the MySQL database server encoding also must be consistent.