News:

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

Main Menu

modification in insert code not working.

Started by Shrink, May 23, 2015, 06:25:35 AM

Previous topic - Next topic

Shrink

Hi,
i had done few modification in insert code i.e., insert msg_url (custom field) it had working for last 3-4 months without any error.
Now i need to insert again new field called "id_brother_topics" I created a column in mysql database. do the modification in insert code. you can find it bellow.
// Insert the post.
$smcFunc['db_insert']('',
'{db_prefix}messages',
array(
'id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => 'string-255','id_brother_topics'=> 'string-255','msg_url' => '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['id_brother_topics'], $msgOptions['msg_url'], $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');

but this time after modification i got a error
QuoteAn Error Has Occurred!
The database value you're trying to insert does not exist: id_brother_topics

i cross check with phpadmin but their is a column exactly correct.
Then i tried to delete cache but it was already empty.
Then i tried to rename column but it is also fail.
Then i move back to my original name & optimize, repairer mysql database.
Then i do maintenance in forum admin section.
but still the error is same.
please help me.
 

Kindred

It is not telling you that the column does not exist, it is telling you that youvarevtrying to insert a value that has not been defined...   The problem is not in your database, but in the fact that your insert CODE is using a variable with no value and no definition.
Сл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."

Shrink

Quote from: Kindred on May 23, 2015, 10:18:37 AM
It is not telling you that the column does not exist, it is telling you that youvarevtrying to insert a value that has not been defined...   The problem is not in your database, but in the fact that your insert CODE is using a variable with no value and no definition.

ohh Great thanks a lot brother..
now i found the problem. I miss the entry in /Sources/Post.php ==>// Collect all parameters for the creation or modification of a post.
Thanks lot. :)

Advertisement: