The phpcms system has an SQL statement (add article content). I recorded the SQL statements it executes into the file and found that there is a field that is not inserted or has no default value, I don't know how the SQL statement is successfully executed. If I execute the statement in phpmyadmin, an error is reported. The following SQL statement...
The phpcms system has an SQL statement (add article content). I recorded the SQL statements it executes into the file and found that there is a field that is not inserted or has no default value, I don't know how the SQL statement is successfully executed. If I execute the statement in phpmyadmin, an error is reported.
The following SQL statement does not contain the typeid field. This field is non-empty and has no default value. (The data table name has been replaced)
Insert into 'somedb '. 'News' ('hascode', 'style', 'thumb', 'inputtime', 'islink', 'catid', 'title', 'keyword', 'description ', 'posids', 'status', 'updatetime', 'username', 'sysadd') VALUES ('0', '','', '123', '0 ', '1', 'let's see what's going on here? ',' The case. 'Let's take a look at the situation? ', '0', '99', '000000', 'wenhua', '1 ')
The above error is that the same SQL statement is executed in phpmyadmin, but it can be successfully executed in phpcms. What is the problem?
Reply content:
The phpcms system has an SQL statement (add article content). I recorded the SQL statements it executes into the file and found that there is a field that is not inserted or has no default value, I don't know how the SQL statement is successfully executed. If I execute the statement in phpmyadmin, an error is reported.
The following SQL statement does not contain the typeid field. This field is non-empty and has no default value. (The data table name has been replaced)
Insert into 'somedb '. 'News' ('hascode', 'style', 'thumb', 'inputtime', 'islink', 'catid', 'title', 'keyword', 'description ', 'posids', 'status', 'updatetime', 'username', 'sysadd') VALUES ('0', '','', '123', '0 ', '1', 'let's see what's going on here? ',' The case. 'Let's take a look at the situation? ', '0', '99', '000000', 'wenhua', '1 ')
The above error is that the same SQL statement is executed in phpmyadmin, but it can be successfully executed in phpcms. What is the problem?
Post the table definition to us:
Show create table name;
The error is that the typeid field of the zhenbenling. news table does not have a default value (and it does not allow null values). You must provide this field value when inserting it! Even ''!
For your convenience, modify the constraints in this column:
use zhenbenling;alter table news change typeid typeid smallint(5) NOT NULL DEFAULT '';
Are you sure you can find the insert record in phpcms? It is normal for phpadmin to report an error.
Set the default value for the typeid field or leave it blank.