insert error

insert error

INTONEINTONE Posts: 153Questions: 58Answers: 6
edited May 2018 in Editor

I have an issue where I am using data tables as my database abstraction layer. I have an issue where if I pass an array to an insert method like this:

$userIDsToInsert = ['key1'=>value,'key2'=>value];
$db()->insert( "table", $userIDsToInsert );

I get this error that says: Uncaught Error: Function name must be a string in /home/judf73/public_html/nessapp/includes/php/cronjobs/processGifts.php:76 where line 76 is the above insert. All other data tables queries work as expected. For completion, I will show you the complete file.

<?php
require __DIR__.'../../../../vendor/autoload.php';
include( "../../../Editor-PHP-1.6.2/php/DataTables.php" );
include("../../functions.inc.php");

use
    DataTables\Editor,
    // DataTables\Editor\Field,
    // DataTables\Editor\Format,
    // DataTables\Editor\Mjoin,
    // DataTables\Editor\Options,
    // DataTables\Editor\Upload,
    // DataTables\Editor\Validate,
    Underscore\Underscore as _;

$k = $db->raw()->exec( "SELECT * from table")->fetchAll();
$userIDsToInsert = ['key1'=>value,'key2'=>value];
$db()->insert( "table", $userIDsToInsert );

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    edited May 2018 Answer ✓
    $db()->insert( "table", $userIDsToInsert );
    

    Should just be:

    $db->insert( "table", $userIDsToInsert );
    

    Allan

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    Oh boy, I can't believe I missed that one. Thank you.

This discussion has been closed.