Title: Using variables to pull data
Last modified: April 19, 2021

---

# Using variables to pull data

 *  [timsilva2](https://wordpress.org/support/users/timsilva2/)
 * (@timsilva2)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/using-variables-to-pull-data/)
 * Hello. I just installed your plugin and love it so far. Should get the premium
   soon. I have a few questions to see what else it can be used for. Here is one:
   Can it be used to pull data fields from the database by using variables? Be it
   in a post or page content? Something like: “The state of %%state_name%% consists
   of %%city_count%% cities.”
 * Thanks
 * Tim

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [timsilva2](https://wordpress.org/support/users/timsilva2/)
 * (@timsilva2)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/using-variables-to-pull-data/#post-14339158)
 * Hi Peter. To be even more specific, what I’m trying to do is to have a way to
   populate a tooltip dynamically. So, in the example above, if a user clicks (or
   hover) over the word “Texas” in a page content, it will pull the Texas info from
   the DB. If a Bible verse reference, it will pull the actual verse from the DB.
   There are plugins that do that already, but for some reason they slow the page
   load too much if you have a large database (I’ve tried many). Your programing
   skills seems to have solved this major obstacle. I would appreciate any pointer.
   Thanks
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/using-variables-to-pull-data/#post-14339862)
 * Hi Tim,
 * Looks like you need some kind of shortcode solution to add content to your web
   page which accesses the database on mouse over I guess? WP Data Access does not
   have such a shortcode, but you could use the Code Manager to write a PHP shortcode
   implementation and use the WP Data Access library to access your database. This
   would allow you to even access a remote database from your own PHP code like 
   this:
    `$wpdadb = \WPDataAccess\Connection\WPDADB::get_db_connection( $schema_name);`
   Where $schema_name is either the schema name of your local database or a remote
   database (needs to be added in the Data Exxplorer). You can use $wpdadb to access
   the database and add content to your webpage. If you want to use shortcode parameters
   you can write your own shortcode which requires the premium version of the Code
   Manager.
 * Does this help?
    Peter

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using variables to pull data’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

## Tags

 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 2 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/using-variables-to-pull-data/#post-14339862)
 * Status: not resolved