×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Marco Matta
Added: Aug 27, 2021 1:24 PM
Modified: Aug 27, 2021 2:37 PM
Views: 3454
Tags: drupal
  1. $database = \Drupal::database();
  2. $result = $database->query("SELECT ... where id = :id", [
  3. ':id' => $this->id
  4. ]);
  5.  
  6. if ($result) {
  7.         while ($row = $result->fetchAssoc()) {
  8.                 // access results $row['row_name'];
  9.         }
  10. }