How do I search for PhpMyAdmin data to display on the screen using Drupal 8?

0

I created a table in phpmyadmin with some acronyms I use at work, and I need to throw that data into the content of a page I created. How would I do that? NOTE: I am working with DRUPAL 8

    
asked by anonymous 23.07.2018 / 20:23

1 answer

0

If you created the table in the same database that Drupal uses, you can use db_query to fetch the content.

Below is an example of a Static Query (static search). Since you created the table in PHPMyAdmin yourself, I'm assuming that this is a fairly simple query.

$query = db_query("SELECT * FROM {NomeDaSuaTabela}");
$records = $query->fetchAll();

Static Queries ( link ) link ) should only be used for simple searches, preferably not using tables that can be modified via the Drupal interface.

To look for more complex use Dynamic Queries ( link ).

Considering that these are acronyms, I would suggest using Taxonomy instead of a table of your own.

    
01.08.2018 / 21:58