News:

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

Main Menu

Database Error

Started by ryan_dwight, February 26, 2019, 01:29:54 PM

Previous topic - Next topic

ryan_dwight

i got this error when I tried forum maintenance using Find and repair any errors. I attached the error txt file for the result then when I clicked fix, I got this error.

Database Error
Field 'add_authors' doesn't have a default value
File: /home/ptcb/public_html/Sources/RepairBoards.php
Line: 1486

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

Then when I try to upgrade using the large file, it became like this

Database Error
Field 'add_authors' doesn't have a default value
File: /home/ptcb/public_html/Sources/RepairBoards.php
Line: 1486


i also attached the repairboards.php

Thank you in advance

Kindred

it's not a php error, it's a mysql error.


give the add_authors column a default value in mySQL (use phpmyadmin)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ryan_dwight

Thank you for the quick reply Kindred

Would you be so kind if you tell me how to do that. thank you

Kindred

go to phpmyadmin
find the column



https://stackoverflow.com/questions/39674404/mysql-1364-field-column-name-doesnt-have-a-default-value-cant-insert-in
Quote
t means you have 2 options:

    -- Mark your field as NULL (first check if your field is required to have some value or not).

    ALTER TABLE your_table CHANGE COLUMN your_field your_field VARCHAR(250) NULL;

    -- Add a default value to the field so if no data is provided on insert, it will put something you defined. For example:

    ALTER TABLE your_table CHANGE COLUMN your_field your_field VARCHAR(250) NOT NULL DEFAULT 'some_default_value';

    And ofcourse match your field type to the field your are going to change.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Doug Heffernan

Quote from: ryan_dwight on February 26, 2019, 02:11:28 PM
Thank you for the quick reply Kindred

Would you be so kind if you tell me how to do that. thank you

Copy/paste this sql query to the SQL Box of your phpmyadmin, or whatever tool you are using to manage the database.

ALTER TABLE smf_topics CHANGE add_authors add_authors NULL;


ryan_dwight

thank you for the help doug_ips

I got this error
SQL query:

ALTER TABLE smf_topics CHANGE add_authors add_authors NULL

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1


Is there a problem on the new version?

vbgamer45

No, you have set the date type. What data type was add_authors in the table? You can look under table structure for smf_topics
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight

Thank you for the reply cbgamer45

18    add_authors    text    utf8_general_ci       No    None    

on the type column "text"

vbgamer45

Change your sql to
ALTER TABLE smf_topics CHANGE add_authors add_authors text NULL;
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight

the error was gone on the forum maintenance but on the main site as a guest

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

vbgamer45

Check your forum's error log to see if you can find the error.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight


vbgamer45

Under admin -> Security and Moderation make sure enable error logging is enabled
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight


Kindred

sounds like you have a bad mod
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ryan_dwight

i think there is much of a problem.

the image is on the lower part of forum maintenance

I tested on default theme

Sir Osis of Liver

You should have just edited the field in phpmyadmin, not used a query.  You may have damaged the database.  Try connecting the db to a clean install.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on February 26, 2019, 04:50:56 PM
You should have just edited the field in phpmyadmin, not used a query.  You may have damaged the database.  Try connecting the db to a clean install.


All phpMyAdmin would have done is run that query.

However the issues shown above are not consistent with a database fault, something else is very wrong.

Sir Osis of Liver

PMA would have run the query correctly, it's not always safe to assume that a poster with limited experience would do the same.  If db runs ok connected to clean install, then it's something else.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ryan_dwight

how can I run the db to a clean install. I have limited experience on this. Your help is much appreciated.

Advertisement: