function db_insert

7.x database.inc db_insert($table, array $options = array())
8.x database.inc db_insert($table, array $options = array())

Returns a new InsertQuery object for the active database.

Parameters

$table: The table into which to insert.

$options: An array of options to control how the query operates.

Return value

InsertQuery A new InsertQuery object for this connection.

Related topics

151 calls to db_insert()
actions_synchronize in drupal/includes/actions.inc
Synchronizes actions that are provided by modules in hook_action_info().
aggregator_categorize_items_submit in drupal/modules/aggregator/aggregator.pages.inc
Form submission handler for aggregator_categorize_items().
aggregator_save_category in drupal/modules/aggregator/aggregator.module
Adds/edits/deletes aggregator categories.
aggregator_save_feed in drupal/modules/aggregator/aggregator.module
Add/edit/delete an aggregator feed.
aggregator_save_item in drupal/modules/aggregator/aggregator.processor.inc
Adds/edits/deletes an aggregator item.

... See full list

File

drupal/includes/database/database.inc, line 2459
Core systems for the database layer.

Code

function db_insert($table, array $options = array()) {
  if (empty($options['target']) || $options['target'] == 'slave') {
    $options['target'] = 'default';
  }
  return Database::getConnection($options['target'])->insert($table, $options);
}