Function DatabaseConnector->query_select

Definitions

sources/database.php

  • Get the database rows found matching the specified parameters. Unlike 'query', it doesn't take raw SQL -- it assembles SQL based the parameters requested.Only use this if you're where condition is a series of AND clauses doing simple property comparisons.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$table string No No required parameter N/A N/A The table name
$select array No No [ "*" ] N/A N/A The SELECT map
$where_map array No No [] N/A N/A The WHERE map [will all be ANDed together]
$end string No No Blank (empty string) N/A N/A Something to tack onto the end of the SQL query
$max ?integer No No Null N/A N/A The maximum number of rows to select (null: get all)
$start integer No No 0 N/A N/A The starting row to select
$fail_ok boolean No No False N/A N/A Whether to allow failure (outputting a message instead of exiting completely)
$lang_fields ?array No No Null N/A N/A Extra language fields to join in for cache pre-filling / Tempcode, perhaps via the find_lang_fields function. You only need to send this if you are doing a JOIN and carefully craft your query so table field names won't conflict (null: auto-detect, if not a join)

Returns

  • The results (empty array: empty result set) (null: error)
  • Type: ?array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get the database rows found matching the specified parameters. Unlike 'query', it doesn't take raw SQL -- it assembles SQL based the parameters requested.Only use this if you're where condition is a series of AND clauses doing simple property comparisons.
 *
 * @param  string $table The table name
 * @param  array $select The SELECT map
 * @param  array $where_map The WHERE map [will all be ANDed together]
 * @param  string $end Something to tack onto the end of the SQL query
 * @param  ?integer $max The maximum number of rows to select (null: get all)
 * @param  integer $start The starting row to select
 * @param  boolean $fail_ok Whether to allow failure (outputting a message instead of exiting completely)
 * @param  ?array $lang_fields Extra language fields to join in for cache pre-filling / Tempcode, perhaps via the find_lang_fields function. You only need to send this if you are doing a JOIN and carefully craft your query so table field names won't conflict (null: auto-detect, if not a join)
 * @return ?array The results (empty array: empty result set) (null: error)
 */

public function query_select(string $table, array $select = ["*"], array $where_map = [], string $end = '', ?int $max = null, int $start = 0, bool $fail_ok = false, ?array $lang_fields = null) : ?array