Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: dj_king on July 29, 2024, 07:20:12 AM

Title: Re: Unable to add new post - database problem
Post by: dj_king on July 29, 2024, 07:20:12 AM
Quote from: Aleksi "Lex" Kilpinen on March 19, 2021, 08:06:57 AMThe "Field 'karma_bad' doesn't have a default value" error is simple really, you just need to assign that field a default value in the database, usually if there is not one set already, NULL will do.


I have the same problem. I deleted the 2 tables that the previous colleague said, and it still gives me the same problem.

I updated my forum from an older version to the latest one, and everything was fine... until I decided to post. Any solution please? A hug and thank you!
Title: Re: Re: Unable to add new post - database problem
Post by: Aleksi "Lex" Kilpinen on July 29, 2024, 07:28:19 AM
If you deleted the table mentioned in the error, there is no possibility that the error is the same. Also, blindly deleting tables is a BAD idea.
If the error is still X "doesn't have a default value", the solution is still to give the mentioned field X a default value. Usually NULL will be fine.
Title: Re: Re: Unable to add new post - database problem
Post by: dj_king on July 29, 2024, 07:38:15 AM
Well the error is this:

Field 'karma_bad' doesn't have a default value
File: /home/icivjqn/www/foro/Sources/Subs-Post.php
Line: 1897

I don't know how to solve it. I need professional help, even if it costs me money please.
Title: Re: Re: Unable to add new post - database problem
Post by: Aleksi "Lex" Kilpinen on July 29, 2024, 07:41:56 AM
Locate the field in your database, and give it a default value.
Most likely, you would find this field in smf_messages.

You could try running ALTER TABLE smf_messages ALTER karma_bad SET DEFAULT NULL;

If this works, the error will likely change to a different field, that you will need to update as well.
Title: Re: Re: Unable to add new post - database problem
Post by: dj_king on July 29, 2024, 07:47:13 AM
Quote from: Aleksi "Lex" Kilpinen on July 29, 2024, 07:41:56 AMLocate the field in your database, and give it a default value.
Most likely, you would find this field in smf_messages.

You could try running ALTER TABLE smf_messages ALTER karma_bad SET DEFAULT NULL;

If this works, the error will likely change to a different field, that you will need to update as well.

TRUE.

Now it gave me this other error:

Field 'edit_reason' doesn't have a default value
File: /home/icivjqn/www/foro/Sources/Subs-Post.php
Line: 1897

I understand that they are the mods that I had previously installed and that I no longer have.

Do I have to set them all to NULL? I mean... the errors that I get every time I modify a new error?
Title: Re: Re: Unable to add new post - database problem
Post by: Aleksi "Lex" Kilpinen on July 29, 2024, 07:49:43 AM
Yeah, NULL is a fairly safe non-value. So if any error comes up with "doesn't have a default value", NULL usually works.
Title: Re: Re: Unable to add new post - database problem
Post by: dj_king on July 29, 2024, 07:50:30 AM
Quote from: Aleksi "Lex" Kilpinen on July 29, 2024, 07:49:43 AMYeah, NULL is a fairly safe non-value. So if any error comes up with "doesn't have a default value", NULL usually works.

yes!!!!

Thank you!

now it works perfect
Title: Re: Re: Unable to add new post - database problem
Post by: Kindred on July 29, 2024, 09:34:26 AM
In the future, please start your own topic rather than piggy backing on someone else's help thread.