The problem I encountered during development is that when I insert php into the database, the insert operation fails and no error is reported. Really collapsed!
Original code
The Code is as follows: |
Copy code |
$ SQL = "INSERT INTO 'message' ('id', 'user', 'title', 'content', 'lastdate') VALUES ('', '$ _ POST [user]', '$ _ POST [title]', '$ _ POST [content]', 'Now ()')"; Mysql_query ($ SQL ); |
Modified code
The Code is as follows: |
Copy code |
$ SQL = "INSERT INTO 'message' ('user', 'title', 'content', 'lastdate') VALUES ('$ _ POST [user]', '$ _ POST [title]', '$ _ POST [content]', 'Now ()')"; Mysql_query ($ SQL ); |
Remove id, because id is automatically inserted, so remove, So OK!
If the field is tinyint, int ,... the type is either automatically inserted or given the default value. Do not use null values such as 'id' values (''). Because each mysql version is different, problems may occur and the cause cannot be found.