1 database.inc db_select($table, $alias = NULL, array $options = array())

Returns a new SelectQuery object for the active database.

Parameters

string $table: The base table for this query. May be a string or another SelectQuery object. If a query object is passed, it will be used as a subselect.

string|null $alias: The alias for the base table of this query.

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

Return value

SelectQuery: A new SelectQuery object for this connection.

Related topics

File

core/includes/database/database.inc, line 2795
Core systems for the database layer.

Code

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