Function DatabaseConnector->query_select_value_if_there

Definitions

sources/database.php

  • Get the specified value from the database, or null if there is no matching row (or if the value itself is null). This is good for detection existence of records, or for use if they might may or may not be present.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Return: N/A

Parameters

Name Type Default Set Range Description
$table string required parameter N/A N/A The table name
$select string required parameter N/A N/A The field to select
$where_map array [] N/A N/A The WHERE map [will all be ANDed together]
$end string Blank (empty string) N/A N/A Something to tack onto the end
$fail_ok boolean False N/A N/A Whether to allow failure (outputting a message instead of exiting completely)
$lang_fields ?array 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)

Return

  • The first value of the first row returned (null: nothing found, or null value found)
  • Type: ?mixed
  • Set: N/A
  • Range: N/A