Just place some SQL on in the box and save it as a report. You can save multiple reports and they will be listed on the Admin Menu so you can quickly run them again anytime with just one click. You can place your reports on the User’s Dashboard based on Roles. You can also put a report on a Page or Post using a shortcode like [SQLREPORT name=”My Report” style=”padding: 6px;” /]
Updated March 16th
There is also an shortcode for the wpdb::get_var function that you can use to display a single value from your database. For example, this will display the number of users on your site:
[sqlgetvar]SELECT COUNT(*) FROM wp_users[/sqlgetvar]
Automatic Database Backups
Your database can be automatically saved and archived every hour and/or every day, and backups can be emailed to the address you specify. You can also restore the data to your WP DB or an external DB, which makes copying your database to another server and easy task.
- Download and unzip the plugin into your WordPress plugins directory (usually
- Activate the plugin through the ‘Plugins’ menu in your WordPress Admin.
- What do I do after I activate the Plugin?
Start Creating and Saving Reports.
- How do I get one of my reports onto a Page or Post?
Just use the shortcode SQLREPORT like this [SQLREPORT name=”My Report” style=”border: 2px solid #CCCCCC; padding: 6px;” /] but be sure the name attribute matches the exact name of a report you have already created.
- How do I use a global PHP variable in one of my SQL queries?
Note: This < does not display properly on web pages so I used the HTML code < in this example, > works…
SELECT display_name FROM wp_users WHERE ID = ‘<?php $current_user->ID ?>’
(There are other ways to get the display name in WordPress, this is just a simple example to illustrate the proper syntax.)
SELECT * FROM wp_users WHERE user_registered > ‘<?php $_GET[thedate] ?>’
(note: this example assumes you are going to pass ‘thedate’ as a GET variable in the query string and, as this example shows, don’t use quotes inside the PHP brackets.)
Works. Produced a report with some pretty complicated SQL.
Report available both in admin panel, and on a web page.
Sent an annoying issue to the developer, and he updated the plugin within a day.
Looking at support log, developer appears to be responsive to problems.
Works great. Just need better docs for us newbs
Contributors & Developers
“EZ SQL Reports Shortcode Widget and DB Backup” is open source software. The following people have contributed to this plugin.Contributors
Interested in development?
- Removed menu_group option to fix add_object_page deprecated bug.
- Moved mysql_connect to fix deprecation error in some newer versions of PHP.
- Fixed the saving of the custom backup directory setting.
- Fixed two vulnerabilities that could be exploited by site admins, thanks to Felipe Molina for discovering these bugs.
- Upgraded Widget Class for compatibility with WordPress 4.3 changes.
- Fixed some minor styles in the admin pages.
- Added a feature to hide all the reports from the main admin menu.
- Fixed some minor bugs and improved the handling of multiple queries.
- Added a call to do_shortcode to the query results so that shortcodes rendered in a report can be evaluated.
- Made minor layout changes and enhancements to the Edit Reports page.
- Fixed the Delete Report button to work even when the queries fails.
- moved to the global wpdb object for full compatibility with WP 3.9 on MySQL 5.5.
- Fixed table header row that contains column names.
- Added an SQL Reports widget for the sidebar and footer area.
- Added support for multiple queries on one report.
- Improved the compatibility and reliability of the restore process.
- Add ability to place reports on the dashboard for a given Role.
- Created a second method for backups that uses the command line mysql.
- Made compression optional and backup location changable.
- Made restore function able to connect to external an DB.
- Fixed shortcode to work with sanitize_title.
- Added a WP cron scheduler for hourly and daily backups.
- Upgraded the Backup process to ZIP and email all backups.
- Added a shortcode for wpdb::get_var
- Fixed the Backup process to capture VIEW definitions properly.
- Added database backup feature.
- Fixed Report name issue when using apostrophes.
- Added Menu Placement and sorting options.
- Expanded eval function to take multiple global variables.
- Added eval function to take PHP code in the SQL Statement.
- Added css classes to the Table and TRs for better style control.
- Added error message to the Edit Report Page if SQL statement fails.
- Added shortcode support so you can put your reports onto Pages and Posts.
- Added styled DIV around Reports with ID tag so that you can customize the style.