Multiple insert
#1
Hi guys,
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);
My Projects - Support My Projects

Don't forget to rate posts!
Reply
#2
Hi, there's nothing there inserting the actual templates. All you're doing is building an array of the templates to add. You need to call "$db->insert_query_multiple()".
Reply
#3
I updated post

ok now it works, I don't know why not before
My Projects - Support My Projects

Don't forget to rate posts!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)