src/bbn/db.php
public function get_key_val(): ?array
  {
    if ( $r = $this->query(...\func_get_args()) ){
      if ( $rows = $r->get_rows() ){
        return x::index_by_first_val($rows);
      }
      return [];
    }
    return null;
  }
public function get_key_val(): ?array
  {
    if ( $r = $this->query(...\func_get_args()) ){
      if ( $rows = $r->get_rows() ){
        return x::index_by_first_val($rows);
      }
      return [];
    }
    return null;
  }
public function get_key_val ( ) : ? array { if ( $ r = $ this -> query ( ... \ func_get_args ( ) ) ) { if ( $ rows = $ r -> get_rows ( ) ) { return x :: index_by_first_val ( $ rows ) ; } return [ ] ; } return null ; }
Return an array indexed on the first field of the request.
The value will be an array if the request has more than two fields.

```php
\bbn\x::dump($db->get_key_val("SELECT name,id_group FROM table_users"));
/*
(array)[
"John" => 1,
"Michael" => 1,
"Barbara" => 1
]

\bbn\x::dump($db->get_key_val("SELECT name, surname, id FROM table_users WHERE id > 2 "));
/*
(array)[
"John" => [
"surname" => "Brown",
"id" => 3
],
"Michael" => [
"surname" => "Smith",
"id" => 4
]
]
```

@param string query
@param mixed values
@return null|array
Return an array indexed on the first field of the request . The value will be an array if the request has more than two fields .