2016-07-14, 02:37 PM
Hi guys,
I'm trying to insert multiple templates in the database but my code didn't work. Have I used wrong function?
I'm trying to insert multiple templates in the database but my code didn't work. Have I used wrong function?
$templates = [
'forum_display_thread_icon_custom' => '<img src="{$ticon}" alt="" style="max-width: {$mybb->settings[\'ticon_width\']}px; max-height: {$mybb->settings[\'ticon_height\']}px">',
'posticons_custom' => '<tr>
<td class="trow1">
<strong>{$lang->ticon_custom}</strong>
</td>
<td class="trow1">
<input class="fileupload" name="ticon" type="file">
</td>
</tr>',
];
foreach($templates as $name => $content) {
$insert_array[] = [
'title' => $name,
'template' => $db->escape_string($content),
'sid' => '-2',
'version' => '1807',
'dateline' => time(),
];
}
$db->insert_query_multiple('templates', $insert_array);