$zapr = "SELECT tid, `name` FROM `taxonomy_term_field_data`";
$rr = \Drupal::database()->query($zapr)->fetchAllKeyed();
============================
$tel = \Drupal::database()->query($zapr)->fetchAllKeyed();
======
$query = \Drupal::database()->select('users_field_data', 'u');
$query->addField('u', 'name');
$query->condition('u.name', 'miltorg');
$r = $query->execute()->fetchObject();
print $r->name;
<?php
/**
* @return
* Contains \Drupal\summ\Controller\FirstPageController.
*/
namespace Drupal\summ\Controller;
/**
* Provides route responses for the DrupalBook module.
*/
class FirstPageController {
/**
* Returns a simple page.
*
* @return array
* A simple renderable array.
*/
public function content() {
$r = db_query("SELECT * FROM node_field_data WHERE nid=2")->fetchObject();
$element = array(
'#markup' => $r->title,
);
return $element;
}
}