Re: Small modification in Insert the post. code

mardi 24 juin 2014

Hi guys.

I need to add one extra column in {db_prefix}messages table.

i add one column in messages table name as 'msg_url' => 'text'

say 'msg_url' as a text string.

so i add this field in quick reply form first

so Display.template.php becomes.

<strong>URL Associate with this new Post:-> </strong> <div class="quick_msg_url">

<textarea cols="200" rows="1" name="msg_url" >', '</textarea>

</div>



<input type="hidden" name="topic" value="', $context['current_topic'], '" />





<input type="hidden" name="icon" value="xx" /> ..........................

...............................................

..............................................



And Subs-Post.php becomes

$smcFunc['db_insert']('',

'{db_prefix}messages',

array(

'id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => '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['msg_url'], $msgOptions['body'],

$posterOptions['name'], $posterOptions['email'], time(), $posterOptions['ip'],

$msgOptions['smileys_enabled'] ? 1 : 0, '', $msgOptions['icon'], $msgOptions['approved'],

),

array('id_msg')

);



Now when i try to post some thing following errors come

An Error Has Occurred!

The database value you're trying to insert does not exist: msg_url

so please explain me why sql insert function don't find msg_url value. Is it connected with other code? how i can insert that msg_url value form html form to database table.

Thanks in Advance !!




0 commentaires:

Enregistrer un commentaire

 

Lorem

Ipsum

Dolor