[RSS Feed/News] Insert multiple rows through a loop doesn't work

Status
Not open for further replies.

XenForo

Administrative
  • Thread starter
  • Admin
  • #1
Hi,
I want insert multiple arrays through a loop to my database. The foreach loop seems to work, but only one entry is saved to the database.

PHP:

Code:
$visitor = \XF::visitor();
$fooRequest= \XF::em()->create ('Foo\AddOn:Class1');
$fooRequest->bulkSet([
    'userid' => $visitor->user_id,
    'username' => $visitor->username,
    'title' => $package->title,
    'created' => $dateTime->format('Y-m-d H:i:s'),
    'planid' => $package->id
]);
$fooRequest->save();
$lastId = $fooRequest->get('id')...

Read more

ادامه مطلب...
 
Status
Not open for further replies.
Back
Top Bottom