Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Sudhakar Arjunan on June 06, 2023, 05:55:50 PM

Title: Uploading error of image
Post by: Sudhakar Arjunan on June 06, 2023, 05:55:50 PM
Tried uploading an attached and it showed some error. Then home admin homepage shows this

 https://forum.com/index.php?
 /home/forum/public_html/Sources/Subs-Attachments.php (Line 1402)   Backtrace information

Type of error: Critical
Error messageSelect
Wrong value type sent to the database. Array of integers expected. (preview_attachments)
Function: prepareAttachsByMsg
Title: Re: Uploading error of image
Post by: Kindred on June 07, 2023, 10:10:47 AM
what mods do you have installed?
Title: Re: Uploading error of image
Post by: Sudhakar Arjunan on June 08, 2023, 02:04:09 PM
1   Google Analytics Code   1.6.1   02 April 2023, 06:52:12
5   SMF Gallery Lite   7.1a   02 April 2023, 16:12:12 - after installation it tried importing items from aeva media gallery to smf gallery lite but failed ( here is the link for the topic (https://www.simplemachines.org/community/index.php?topic=114291.4220) )
Title: Re: Uploading error of image
Post by: Kindred on June 08, 2023, 02:23:10 PM
i'd suggest uninstalling gallery and see if that fixes things
Title: Re: Uploading error of image
Post by: Sudhakar Arjunan on July 06, 2023, 02:06:42 PM
Quote from: Kindred on June 08, 2023, 02:23:10 PMi'd suggest uninstalling gallery and see if that fixes things
Just got update from author - link (https://www.simplemachines.org/community/index.php?msg=4155707)
not related to the gallery we do not touch file  attachments with SMF Gallery

Still issue persist while trying to upload any attachment to post. Any help
(https://discuss.itacumens.com/gallery/forum_upload_attachment_error_1.png)
(https://discuss.itacumens.com/gallery/forum_upload_attachment_error_2.png)

Error message in log,
Database Error: Field 'id_issue' doesn't have a default value


 INSERT INTO smf_attachments(`id_folder`, `id_msg`, `filename`, `file_hash`, `fileext`, `size`, `width`, `height`, `mime_type`, `approved`)
 VALUES
 (1, 0, SUBSTRING('apple-beta-software-agreement-ea1846.pdf', 1, 255), SUBSTRING('a1439c599dfb2f45febd7b599ee42a503e41731e', 1, 40), SUBSTRING('pdf', 1, 8), 829962, 0, 0, SUBSTRING('application/pdf', 1, 20), 1)
Title: Re: Uploading error of image
Post by: Doug Heffernan on July 06, 2023, 02:26:07 PM
Quote from: Sudhakar Arjunan on July 06, 2023, 02:06:42 PMDatabase Error: Field 'id_issue' doesn't have a default value

Give the aforementioned field a default value of null. That ought to fix it.
Title: Re: Uploading error of image
Post by: Sudhakar Arjunan on July 06, 2023, 03:43:05 PM
Quote from: Doug Heffernan on July 06, 2023, 02:26:07 PM
Quote from: Sudhakar Arjunan on July 06, 2023, 02:06:42 PMDatabase Error: Field 'id_issue' doesn't have a default value

Give the aforementioned field a default value of null. That ought to fix it.

You mean as in here, once you helped me - in this link (https://www.simplemachines.org/community/index.php?msg=4148037)

You are asking me to try
ALTER TABLE smf_attachments SET id_issue NULL

Is it ? do advise.
Title: Re: Uploading error of image
Post by: Doug Heffernan on July 06, 2023, 04:43:25 PM
Quote from: Sudhakar Arjunan on July 06, 2023, 03:43:05 PMYou mean as in here, once you helped me - in this link (https://www.simplemachines.org/community/index.php?msg=4148037)

Yes, but adjust the query accordingly.
Title: Re: Uploading error of image
Post by: Sudhakar Arjunan on July 06, 2023, 10:28:38 PM
Hi Doug Heffernan,

Structure - 15   id_issue  Index   int(10)      UNSIGNED   No   None
Indexes -    id_issue   BTREE   No   No   id_issue   1   A   No   

Tried this command in sql
ALTER TABLE smf_attachments SET id_issue NULL

Returned this error

Error
Static analysis:

2 errors were found during analysis.

A new statement was found, but no delimiter between it and the previous one. (near "SET" at position 28)
Unrecognized alter operation. (near " " at position 40)
SQL query: Copy

ALTER TABLE smf_attachments SET id_issue NULL;

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET id_issue NULL' at line 1
Title: Re: Uploading error of image
Post by: Doug Heffernan on July 07, 2023, 06:34:10 AM
The syntax of the query is not correct by the looks of it.

Try the following, go to the smf_attachments table, click the Structure button at the top, select said column and click the edit button. Next step is to untick the NOT NULL option and save the changes.
Title: Re: Uploading error of image
Post by: Kindred on July 07, 2023, 08:22:11 AM
Your SQL is setting the VALUE for the column....    which you can not do, because that would result in your erasing all of the current values.

you need to set the DEFAULT!

from w3, the format is...
ALTER City SET DEFAULT 'Sandnes';
Title: Re: Uploading error of image
Post by: Sudhakar Arjunan on July 07, 2023, 03:22:53 PM
Noted will try tomorrow and update, thanks kindred also Doug heffernan.
Title: Re: Uploading error of image
Post by: shawnb61 on July 07, 2023, 03:56:48 PM
Pretty sure you need to specify both tablename & colname, something like:
ALTER TABLE tablename ALTER colname SET DEFAULT NULL;

If NULL is not allowed on that column, you may need to provide a different default.

EDIT: Slight tweak to sql above...