Home >Backend Development >PHP Tutorial >ThinkPHP3.2.3, what does this error mean?
The following is the code, the same code, the same database table, in the local wamp environment, the following error is reported.
LAMP on the server, no problem.
I suddenly had this error recently. It has been normal for the past few months.
The problem is that there is no alias field in my database table. Where does it come from?
<code>//写数据库 //--------------------- $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");</code>
ERR: SQLSTATE[HY000]: General error: 1364 Field 'alias' doesn't have a default value
The following is the code, the same code, the same database table, in the local wamp environment, the following error is reported.
LAMP on the server, no problem.
I suddenly had this error recently. It has been normal for the past few months.
The problem is that there is no alias field in my database table. Where does it come from?
<code>//写数据库 //--------------------- $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");</code>
ERR: SQLSTATE[HY000]: General error: 1364 Field 'alias' doesn't have a default value
It is caused by field caching. You must delete everything under the runtime directory, excluding the runtime directory itself. But the premise is that your debugging mode is false, so that the cache will be used. In addition, I recommend that you add a default value to the alias field. Otherwise, the development environment and the online environment may be inconsistent.
This has nothing to do with TP hair.
Make good use of google, http://blog.csdn.net/god8816/article/details/8593419
Have strict mode of mysql been enabled?
The error you got shows that your insert statement lacks the value for alias, and the table structure does not define a default value for the alias field;
You should not hide the problem through the sql_mode of mysql or implicitly through the database Deal with the problem.