Function DatabaseConnector->query_select_value
Definitions
sources/database.php
- Get the specified value from the database. This is the specified value of the first row returned. A fatal error is produced if there is no matching row.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$table | string | No | No | required parameter | N/A | N/A | The table name |
$selected_value | string | No | No | required parameter | N/A | N/A | The field to select |
$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 |
$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 first value of the first row returned
- Type: mixed
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get the specified value from the database. This is the specified value of the first row returned. A fatal error is produced if there is no matching row.
*
* @param string $table The table name
* @param string $selected_value The field to select
* @param array $where_map The WHERE map [will all be ANDed together]
* @param string $end Something to tack onto the end
* @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 mixed The first value of the first row returned
*/
public function query_select_value(string $table, string $selected_value, array $where_map = [], string $end = '', bool $fail_ok = false, ?array $lang_fields = null)
* Get the specified value from the database. This is the specified value of the first row returned. A fatal error is produced if there is no matching row.
*
* @param string $table The table name
* @param string $selected_value The field to select
* @param array $where_map The WHERE map [will all be ANDed together]
* @param string $end Something to tack onto the end
* @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 mixed The first value of the first row returned
*/
public function query_select_value(string $table, string $selected_value, array $where_map = [], string $end = '', bool $fail_ok = false, ?array $lang_fields = null)