Hello,
I am trying to create a new topic on my forum and I get the following error.
Thanks for the help!
That's from a mod. Go into your database and set the field value to 'null'.
Thanks for your answer.
Do you know exactly where in the database?
Don't recognize it, but you can run query to find it -
SELECT table_name,table_schema
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_name='hidden_reason'
I have done what you told me and the error was shown in the table: smf_messages
But now the following error appears:
¡Un error ha ocurrido!
The database value you're trying to insert does not exist: id_board
The following is the PHP code where the error came from before
// Insert the post.
$smcFunc['db_insert']('',
'{db_prefix}messages',
array(
'id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => 'string-255', 'body' => (!empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] > 65534 ? 'string-' . $modSettings['max_messageLength'] : 'string-65534'),
'poster_name' => 'string-255', 'poster_email' => 'string-255', 'poster_time' => 'int', 'poster_ip' => 'string-255',
'smileys_enabled' => 'int', 'modified_name' => 'string', 'icon' => 'string-16', 'approved' => 'int','hidden_reason' => 'null',
),
array(
$topicOptions['board'], $topicOptions['id'], $posterOptions['id'], $msgOptions['subject'], $msgOptions['body'],
$posterOptions['name'], $posterOptions['email'], time(), $posterOptions['ip'],
$msgOptions['smileys_enabled'] ? 1 : 0, '', $msgOptions['icon'], $msgOptions['approved'],
),
array('id_msg')
);
$msgOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}messages', 'id_msg');
Do you see id_board in smf_messages?
Yes, look at it
I think you have a mod problem. Which mods are you running?
No one
Replace the code you posted with:
// Insert the post.
$smcFunc['db_insert']('',
'{db_prefix}messages',
array(
'id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => 'string-255', 'body' => (!empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] > 65534 ? 'string-' . $modSettings['max_messageLength'] : 'string-65534'),
'poster_name' => 'string-255', 'poster_email' => 'string-255', 'poster_time' => 'int', 'poster_ip' => 'string-255',
'smileys_enabled' => 'int', 'modified_name' => 'string', 'icon' => 'string-16', 'approved' => 'int',
),
array(
$topicOptions['board'], $topicOptions['id'], $posterOptions['id'], $msgOptions['subject'], $msgOptions['body'],
$posterOptions['name'], $posterOptions['email'], time(), $posterOptions['ip'],
$msgOptions['smileys_enabled'] ? 1 : 0, '', $msgOptions['icon'], $msgOptions['approved'],
),
array('id_msg')
);
$msgOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}messages', 'id_msg');
If I put the code you mention, I get the error again.
after you found the column did you go to structure tab and set the default as null for that column?
hidden_reason is not a core field, you have remnant code from a broken mod. If you can't fix it, upload clean set of files.
https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files
Lainaus käyttäjältä: Sir Osis of Liver - marraskuu 20, 2019, 11:42:58 AP
hidden_reason is not a core field, you have remnant code from a broken mod. If you can't fix it, upload clean set of files.
https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files
clean files will not remove the column from the database where the issue is happening.
No, but it won't be called by code, so it would be ignored, wouldn't it? He already tried assigning "null" value to the field.
Lainaus käyttäjältä: Sir Osis of Liver - marraskuu 20, 2019, 11:48:56 AP
No, but it won't be called by code, so it would be ignored, wouldn't it? He already tried assigning "null" value to the field.
no it is not ignored, that is the issue. the field has to have something filled in by default.
He already did that, and got a different error (read above).
I don't see where above it says the value was changed, just that it was located in the database.
the errors listed seem to be the same from what I can see.
Lainaus käyttäjältä: spoileds2601 - marraskuu 19, 2019, 10:48:13 AP
I have done what you told me and the error was shown in the table: smf_messages
But now the following error appears:
¡Un error ha ocurrido!
The database value you're trying to insert does not exist: id_board
It may have been done incorrectly, but apparently he did try it.
The issue I put code for is because there were a number of columns, and a number of values for those columns but there were more columns listed than there were values...
It is already resolved, thank you