Function DatabaseConnector->query_value_if_there

Definitions

sources/database.php

  • This function is a variant of query_select_value_if_there, by the fact that it only accepts a complete (and perfect) SQL query, instead of assembling one itself from the specified parameters.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$query string No No required parameter N/A N/A The complete SQL query
$fail_ok boolean No No False N/A N/A Whether to allow failure (outputting a message instead of exiting completely)
$skip_safety_check boolean No No False N/A N/A Whether to skip the query safety check
$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 first value of the first row returned (null: nothing found, or null value found)
  • Type: ?mixed
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * This function is a variant of query_select_value_if_there, by the fact that it only accepts a complete (and perfect) SQL query, instead of assembling one itself from the specified parameters.
 *
 * @param  string $query The complete SQL query
 * @param  boolean $fail_ok Whether to allow failure (outputting a message instead of exiting completely)
 * @param  boolean $skip_safety_check Whether to skip the query safety check
 * @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 ?mixed The first value of the first row returned (null: nothing found, or null value found)
 */

public function query_value_if_there(string $query, bool $fail_ok = false, bool $skip_safety_check = false, ?array $lang_fields = null)