0
I created a table on phpMyAdmin with some acronyms I use at work, and I need to throw this data into the content of a page I created. How would I do that?
I’m working with DRUPAL 8.
0
I created a table on phpMyAdmin with some acronyms I use at work, and I need to throw this data into the content of a page I created. How would I do that?
I’m working with DRUPAL 8.
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). As you yourself created the table in Phpmyadmin, I’m guessing that this is a relatively simple query.
$query = db_query("SELECT * FROM {NomeDaSuaTabela}");
$records = $query->fetchAll();
As Static Queries (https://www.drupal.org/docs/8/api/database-api/static-queries and https://api.drupal.org/api/drupal/core%21includes%21database.inc/Function/db_query/8.4.x) should only be used for simple searches, preferably not using tables that can be modified via the Drupal interface.
For more complex searches use Dynamic Queries (https://api.drupal.org/api/drupal/core%21includes%21database.inc/Function/db_query/8.4.x).
Considering that they are acronyms, I would suggest using Taxonomy instead of a table of its own.
Browser other questions tagged php web-application drupal
You are not signed in. Login or sign up in order to post.
Hello William, the answer from @ndvo brought you solution?
– RXSD