How to display database query results as HTML table in your articles

Tabulizer makes easy to export the results of a database query into a table that can added anywhere in your site, using the appropriate data source. If the relevant database contents change, the linked HTML table will be updated as well.

Let's see a specific example to demonstrate these ideas. We want to display a list of the most popular articles from a specific category. The database query is (#_ will be replaced by the actual database table prefix):

SELECT title, hits FROM #__content WHERE catid = 15 ORDER BY hits DESC LIMIT 10
Since the query results will not have any header row, we add it using a UNION to add the desired header row:
(SELECT 'Article','Popularity') UNION (SELECT title, hits FROM #__content WHERE catid = 15 ORDER BY hits DESC LIMIT 10)

Now, we have formed our query, let's create a new data source of type database table/query with the following settings:


It's always a good idea to preview the data source, in order to make sure we can access the source data.


The final step is to insert the data source to the desired article:


See how it looks like:

ArticlePopularity
Joomla Installation: Overcoming the 2MB file upload limit16309
Create a data table in Wordpress with advanced search capabilities11687
How to import data from an Excel Spreadsheet dynamically11623
RSS Feeds with URL parameters10463
How to enable ReCaptcha v2 in Joomla 2.57681
Displaying really large tables with Tabulizer (+10,000 rows)7265
How to display database query results as HTML table in your articles6568
How to add tables to your Wordpress post or page6120
How to insert images into your HTML table (the right way!)5894
How to import data from a Google Spreadshet document into an article or post like a regular HTML table - Updated5410
Data source can take user defined or system parameters, which can be used in the query construction to create really powerful results. For instance, you could have a query similar to SELECT * FROM orders WHERE user_id = {user_id}. The {user_id} system parameter will be replaced by the actual user id of the currently logged in user, so every user will see a personalized version of the table.