Problems with 'db_insert' after disaster recovery.

Started by aarontharker, August 11, 2020, 01:24:26 AM

Previous topic - Next topic

aarontharker

So after our VPS was hacked and wiped clean for the 2nd time, this time they even managed to delete our backups that the hosting company was making daily for us.  We have decided to move to another hosting company.  I had local backups of the files and thankfully the databases were left alone in the attack so we have recovered those. 

The issue is the new hosting company only supports PHP 7.2 and up so I was forced to upgrade SMF to 2.0.17.  It probably should have been done ages ago so that is a good thing I guess :)  The issue I have is the custom addons I have developed for the forum.  Some of which are like 6 or 7 years old all need updating to work with the newer SMF functions.  I think I have gotten them all sorted at this stage except for one.

All of my 'db_insert' statements are now saying they are missing an argument. 

Too few arguments to function SMF_DB_MySQLi::insert(), 4 passed in ***/public_html/forum/Sources/simacc_admin.php on line 1609 and at least 5 expected

$insert = $smcFunc['db_insert']('insert',
     '{db_prefix}simacc_payments',
          array('pay_date' => 'date', 'id_member' => 'int', 'pay_amt' => 'int', 'comment' => 'text', 'verified' => 'int', 'TYPE' => 'int', 'manual' => 'int',),
  array($today, $id_member, $payment, $_POST['comment'.$i], $_POST['verified'.$i], $type, $manual,)
      );
}


Can anyone tell me what I am missing?

Arantor

What's the primary key on the simacc_payments table?

aarontharker


live627

$insert = $smcFunc['db_insert']('insert',
     '{db_prefix}simacc_payments',
          array('pay_date' => 'date', 'id_member' => 'int', 'pay_amt' => 'int', 'comment' => 'text', 'verified' => 'int', 'TYPE' => 'int', 'manual' => 'int',),
  array($today, $id_member, $payment, $_POST['comment'.$i], $_POST['verified'.$i], $type, $manual,),
          array('id_payment',) // specify keys in the fifth argument: this array
      );
}

aarontharker

ok, I'm an idiot sorry been awake for about 36 hours.  I did see that in the documentation but it said it was for SQLite so I didn't try it.  Thanks for the help guys :)

Arantor

The parameter is mandatory even if it's mostly for Postgres and SQLite.

Advertisement: