News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Database Error

Started by statusjpn, November 28, 2020, 10:46:57 AM

Previous topic - Next topic

statusjpn

Hello all,

I seem to be having a small issue with my website that occured up suddenly, i haven't been making any changes and suddenly when creating a new topic, the following error occurs:

QuoteDatabase Error
Field 'spam' doesn't have a default value
File: /home/website/public_html/Sources/Subs-Post.php
Line: 1880

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.17, while your database is at version 2.0.2. The above error might possibly go away if you execute the latest version of upgrade.php.

When replying to an existing topic however, there is no issue.

Does anyone know what the problem might be and how i can fix it?

Thanks in advance!

statusjpn

Btw, my forum, files, database, etc are and should all be at 2.0.17, there was never an issue until recently.

Cheers!

P.S. Where might i find this upgrade.php? Should i just run the script and see if it solves the issue?

shadav

it's a mod that you installed

you will need to go into your database
find
(prefix)_topics and click on structure
then find
spam and click on change
set default to none

you will probably need to do this for a few other things
usually they are either in the topics or the messages tables

Sir Osis of Liver

You can search the database for column names by running a query -



SELECT table_name,table_schema
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_name='spam'



There were no database changes in 2.0 branch, you don't need to run upgrade.php.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

statusjpn

Quote from: shadav on November 28, 2020, 10:57:29 AM
it's a mod that you installed

you will need to go into your database
find
(prefix)_topics and click on structure
then find
spam and click on change
set default to none

you will probably need to do this for a few other things
usually they are either in the topics or the messages tables

Hi,

Thanks for your advice. I have gone into Topics then Structure, and the default value for "Spam" is already at "None".

I tried looking in a few other tables but was unable to find any "Spam".

Would you have any idea where else they are?

I am accessing the DB via cPanel / phpMyAdmin.

statusjpn

Quote from: Sir Osis of Liver on November 28, 2020, 03:33:44 PM
You can search the database for column names by running a query -



SELECT table_name,table_schema
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_name='spam'



There were no database changes in 2.0 branch, you don't need to run upgrade.php.

I have execute the query, and the only table with "Spam" is smf_topics.

I have gone into the structure and changed the default value of "Spam" to "None" as per advice above, but am still facing the same issue.  :(

Sir Osis of Liver

You have to set it to 'null', not 'none'.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shadav

sorry that's my fault...I meant null not none
*really should have my coffee before I try to answer things*

you'll get this same error sometimes for other things, or at least I have so you'll have to do the same thing for those in the database changing them to null

some host settings make this and issue while others do not...

statusjpn

Worked perfect, guys.

Thank you SO MUCH!

This is what i love about SMF honestly, the help from the forums are so quick, even faster than many other paid forums.

Cheers!

Sir Osis of Liver

Don't remember which mod adds that field, but believe it's the only one.  Mysql didn't used to be so fussy, but more recent versions require a default value, and that causes problems with some older mods.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shadav

Quote from: Sir Osis of Liver on November 28, 2020, 05:07:54 PM
Don't remember which mod adds that field, but believe it's the only one.  Mysql didn't used to be so fussy, but more recent versions require a default value, and that causes problems with some older mods.

there's a couple of them but I don't remember which ones that I had this issue with, and usually don't notice until later  :laugh: when I go to either create a new topic or reply to a topic and get these doesn't have a default value errors

thankfully easy to fix, just got to find where in the db the tables are

Advertisement: