miniBB Support Forums | 16 years on The Web
miniBB ® 

miniBB

®
  
 | Begin | Register | Reply | Search | Statistics | File Bank | Manual |
Bugs miniBB Support Forums / Bugs /   
 

When posting a new topic: Incorrect datetime value: '0000-00-00 00:00:00'

 
Author flyup
Partaker
#1 | Posted: 17 Feb 2018 04:28 
Hello. I'm testing a new forum install and new topic post. I am receiving the following error when trying to post a new topic:

Incorrect datetime value: '0000-00-00 00:00:00' for column 'topic_last_post_time' at row 1. Try another name or value.

Can somebody help me? Thanks!

Author flyup
Partaker
#2 | Posted: 17 Feb 2018 17:00 
I figured this out:

add to my.cnf

[mysqld]
sql_mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE"

Author Paul
Lead Developer
#3 | Posted: 17 Feb 2018 20:40 
Thanks for this report; what mySQL version do you use? It appears sort of mySQL related version, possibly we could fix it by default for future releases...

Author Paul
Lead Developer
#4 | Posted: 20 Feb 2018 18:54 | Edited by: Paul 
I've analyzed this more deeply and could conclude you're using mySQL at least of the version 5.7, in which '0000-00-00 00:00:00' is not a valid DATETIME value anymore. Since then, this also needs to be updated in the current stable and developed version of miniBB.

The steps to complete for the newer mySQL version (this will also work for miniBB 3.2.2):

1) In case you are installing the fresh forum, modify _install_mysql.sql and remove NOT NULL default '0000-00-00 00:00:00' for the following fields: post_time, topic_time, topic_last_post_time, user_regdate. NULL values for these fields are not truly "wanted", but they all will be formed in/recorded from the script itself, so the older structure could be removed.

2) In case you already have an existing forum, and like to migrate it to/make it compatible with the newer mySQL 5.7+, you need to update your database with the following commands (substitute your own custom field names in the case you have them):

ALTER TABLE minibbtable_posts MODIFY post_time datetime;
ALTER TABLE minibbtable_topics MODIFY topic_time datetime;
ALTER TABLE minibbtable_topics MODIFY topic_last_post_time datetime;
ALTER TABLE minibbtable_users MODIFY user_regdate datetime;

The same could be done for whatever add-ons you may have installed and which previously contained the '0000-00-00 00:00:00' value for the datetype field as default.

3) Edit bb_func_ptopic.php and after the line which is `$topic_time=date('Y-m-d H:i:s');` add the new line: `$topic_last_post_time=$topic_time;` so it looks like:

$topic_time=date('Y-m-d H:i:s');
$topic_last_post_time=$topic_time;

This all is currently fixed in miniBB 3.3 v2.

Author tom322
Active Member
#5 | Posted: 20 Feb 2018 20:29 
Regarding point 2) above - are these full commands there (shouldn't be there something like: SET after the MODIFY) - currently it seems to modify but not sure if it knows to what it should modify?

Author Paul
Lead Developer
#6 | Posted: 21 Feb 2018 21:47 | Edited by: Paul 
tom322:
are these full commands there

Yes, they are, I've tested them on this forum and on minibb.org, both worked.

MODIFY means the change of DB field attributes; in our case, we remove 'not null' i.e. they could be NULL, and remove the default value.

Author flyup
Partaker
#7 | Posted: 23 Feb 2018 20:33 
Hello Paul.

Are you still offering quotes for miniBB integrations?

Author Paul
Lead Developer
#8 | Posted: 24 Feb 2018 22:19 
flyup:
Are you still offering quotes for miniBB integrations?

Yes, I provide such support in terms of our Paid Service.

Bugs miniBB Support Forums / Bugs /
 When posting a new topic: Incorrect datetime value: '0000-00-00 00:00:00'
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


 ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
↑ TOP