Here is the code, the same code, the same database table, in the local WAMP environment, the following error is reported.
The lamp on the server, there is no problem.
The last few months have been normal for a sudden mistake.
The problem is, in my database table, there is no alias in this field, where does it come from?
//写数据库//---------------------$data['user_mail'] = $user_mail;$data['user_name'] = $user_name;$data['pass_word'] = md5($pass_word);$data['last_time'] = date('Y-m-d H:i:s');$addRes = $usr -> add($data);\Think\log::record("6");
ERR:SQLSTATE[HY000]: General error:1364 Field ' alias ' doesn ' t has a default value
Reply content:
Here is the code, the same code, the same database table, in the local WAMP environment, the following error is reported.
The lamp on the server, there is no problem.
The last few months have been normal for a sudden mistake.
The problem is, in my database table, there is no alias in this field, where does it come from?
//写数据库//---------------------$data['user_mail'] = $user_mail;$data['user_name'] = $user_name;$data['pass_word'] = md5($pass_word);$data['last_time'] = date('Y-m-d H:i:s');$addRes = $usr -> add($data);\Think\log::record("6");
ERR:SQLSTATE[HY000]: General error:1364 Field ' alias ' doesn ' t has a default value
The field cache causes you to delete everything under the runtime directory, excluding the runtime directory itself. But the premise is that your debug mode is false to use the cache, and I recommend that you add a default value to the Alias field, otherwise it might be the reason why the development environment is inconsistent with the on-line environment.
This has nothing to do with TP hair.
Use Google, http://blog.csdn.net/god8816/article/details/8593419
Did you turn on MySQL strict mode?
Your error indicates that your INSERT statement lacks a value for alias, and then the table structure does not define a default value for the alias field;
You should not use the MySQL Sql_mode to hide the problem or implicitly handle the problem through the database.