ThinkPHP3.2.3, what does this error mean?

WBOY
Release: 2016-07-06 13:54:06
Original
1503 people have browsed it

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.

  1. 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>
Copy after login
Copy after login

ERR: SQLSTATE[HY000]: General error: 1364 Field 'alias' doesn't have a default value

Reply content:

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.

  1. 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>
Copy after login
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!