Skip to content

Instantly share code, notes, and snippets.

@mrsinguyen
Created June 6, 2010 04:49
Show Gist options
  • Save mrsinguyen/427306 to your computer and use it in GitHub Desktop.
Save mrsinguyen/427306 to your computer and use it in GitHub Desktop.
Drupal's Database API, Multi-insert form
<?php
$values = array(
array(
'title' => 'Example',
'uid' => 1,
'created' => REQUEST_TIME,
),
array(
'title' => 'Example 2',
'uid' => 1,
'created' => REQUEST_TIME,
),
array(
'title' => 'Example 3',
'uid' => 2,
'created' => REQUEST_TIME,
),
);
$query = db_insert('node')->fields(array('title', 'uid', 'created'));
foreach ($values as $record) {
$query->values($record);
}
$query->execute();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment