Habari\DatabaseConnection::get_keyvalue PHP Method

get_keyvalue() public method

Returns an associative array using the first returned column as the array key and the second as the array value
public get_keyvalue ( string $query, array $args = [] ) : array
$query string The query to execute
$args array Arguments to pass for prepared statements
return array An array containing the associative data $ary= $dbconnection->get_keyvalue( 'SELECT keyfield, valuefield FROM tablename');
    public function get_keyvalue($query, $args = array())
    {
        if ($this->query($query, $args)) {
            $output = $this->pdo_statement->fetchAll(\PDO::FETCH_KEY_PAIR);
            return $output;
        } else {
            return false;
        }
    }