db_select

Definition

db_select($table, $alias = NULL, Array $options = array())
drupal/includes/database/database.inc, line 1694

Description

Returns a new SelectQuery object for the active database.

Parameters

$table The base table for this query.

$alias The alias for the base table of this query.

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

Return value

A new SelectQuery object for this connection.

Related topics

Namesort iconDescription
Database abstraction layerAllow the use of different database servers using the same code base.

Code

function db_select($table, $alias = NULL, Array $options = array()) {
  if (empty($options['target'])) {
    $options['target'] = 'default';
  }
  return Database::getActiveConnection($options['target'])->select($table, $alias, $options);
}