Mysql errors: sql modes-strict mode, TIMESTAMP implicit DEFAULT is deprecated
Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
-
Alecos
- Posts:18
Mysql errors: sql modes-strict mode, TIMESTAMP implicit DEFAULT is deprecated
Code: Select all
2016-10-27T08:05:25, 0, Warning, TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-27T08:05:25, 0, Warning, 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
class.rating.php
pastebin.com/smgUqUuk
create_tables.php
pastebin.com/C2KEGNVT
Since the code is very big I posted the source code to pastebin...
How to fix the warnings showed in the log? I'm using MySQL 5.7 and PHP 7.0.12 and Apache 2.4
Admin
Posts:805
Hello
1. I think those mysql errors are not from the Ajax Rating script, the script has not a column with TIMESTAMP value.
Perhaps it is something from the mysql configuration in my.cnf or my.ini.
I not know about mysql configs.
Alecos
Posts:18
Solved!!! The fault was of MySQL and not of your script... solved the issue by editing the following files:
find this in my.ini:
Code: Select all
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
replace with this in my.ini
Code: Select all
# Set the SQL mode to strict
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
find this in my-default.ini
Code: Select all
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLE
replace with this in my-default.ini
restart apache & mysql server, see into logs and the warning will disappear... Just tested!!!
Alecos
Posts:18
For solving this:
Code: Select all
Warning, TIMESTAMP with implicit DEFAULT value is deprecated...
add to my.ini this directive:
Admin
Posts:805
Thank you for posting the solution to fix those errors. Maybe will be useful for someone.