Why don’t you directly echo the $num as it will contain the count of rows already…Here’s the edited part..
//To show number of rows in table
function DB_Tables_Rows()
{
global $wpdb;
$table_name = $wpdb->prefix . 'mydata';
$count_query = "select count(*) from $table_name";
$num = $wpdb->get_var($count_query);
echo $num . 'Rows Found';
}
Related Posts:
- Creating two database tables via plugin
- insert data in database table from plugin with WP3.1
- DROP TABLE with uninstall hook not working
- What database state changes happen after a post is manually “updated” with no changes?
- wpdb get_var is not returning any result (verified mysql query returns only one value)
- Insert data in custom table during new post creation
- Plugin Options Not Saving to Database in WP 4.5
- Get posts from WP_Query and format them on admin_head
- Not getting author rank when using return
- Doubt using $wpbd->get_col for a single column
- How to query the custom fields by language?
- Access WordPress database outside of WordPress
- How to create custom tables in WordPress using my own plugin?
- How do I “get the next 10 posts after post_id == x”?
- How to access data in wordpress database externally using php
- Is it possible to create Custom Post plug-in?
- WordPress Settings Lost After Site Migration
- switched from query_posts to WP_query, not working now?
- Help With MySQL to WPDB Query Conversion
- AJAX search posts and pages
- custom user tables supported in SharDB plugin?
- How to check if tables in WordPress still exists after activations
- how to oauth1 Wp plug-in revoke/reset.?
- Prevent duplicate records in plugin table
- How to change this WP_Query to get all ProductIDs and not only specific one?
- How can I perform high-level database merging for WordPress within continues delivery?
- Delete query not working in plugin
- How to remove traces from widget during uninstallation
- How to call WordPress function other files
- Insert content of a post into another
- How do I network enable a plugin for a multisite install via the database?
- WP_Query and NULL meta keys
- WordPress Backend HA (Automatic failover)
- import posts with dutch/special letters
- Automatic switch to backup database on fail
- how to use in custom single.php template using php?
- How can I change the meta_key for a particular piece of information?
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- WordPress Integration with Google Groups
- Create a table with wordpress plugin boilerplate
- wp_editor content in plugin options page
- WordPress page and plugin list using sql query
- Multiple instance of data in plugin custom database table on plugin activation
- How to create a custom shortcode based on the layout?
- Using AJAX to generate front end / viewer end pages
- WordPress and a secondary database?
- WordPress plugin creating database in localhost but not on real host
- Why this function not working for install database on plugin activation
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- “Master” WordPress Multisite – Database Sync
- Better ads plugin has 500.000 entries in wp_postmeta
- WooCommerce search products between price range using WP_Query
- ACF: post query, hide duplicate values [closed]
- Redirect to another page using contact form 7? [closed]
- How to create multiple database tables on plugin activation?
- Can I create a table on my DB without creating a plugin?
- WordPress : Explain Plugins & Theme string value in database
- Is it necessary to auto delete my WP plugin database tables when users deactivate/delete my plugin?
- Does deleting a Plugin via the WordPress admin ‘completely’ remove the code?
- Creating a CSV with PHP inside the plugin directory
- Plugins in WP_Options but not Active
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- How to insert multiple postmeta values with one query?
- How do i edit the plugin files in DataBase via phpMyAdmin?
- WordPress as a data-store?
- How to insert and call new data in wordpress website database through a plugin
- Gathering and logging data from a plugin: how to do it without race conditions?
- How to pass the API key to the client from the database? [closed]
- WPDB: Update table
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- Issue running db create table query from static method
- Problem of encoding characters (apostrophes) in my posts publications
- Separate database for a wordpress plugin
- Is there a rule for wordpress plugins developers to not do any database changes upon update?
- How to keep variable `$post` to using in another file
- dbDelta not adding additional columns in plugin database update
- How to get a list of bundled products using wp_query in woocommerce
- order posts by `meta_key`, Does not display posts that does not have `meta_key`
- WordPress Apply filter in plugin causes 500 internal error
- Updating options into the wp database performance
- Meta query for comparing two dates
- Replacing global wp_query
- Making my plugin create a page?
- Ajax save data to database on document ready, no data being saved
- Add some fileds to the wp_posts table
- How to edit a published post?
- Best/Correct way to add an option to a category
- Error in pdf generating plugin using FPDF
- Plugin has added weird data in wp_options, set to autoload
- Return multiple values in a shortcode attribute
- Always get creating a new table with foreign key
- How to do database for download stats?
- What is the WordPress approach to custom data?
- How to create plugin/ page that reads from database
- How retreive saved data from gravity forms in my template?
- woocommerce search by sku and title ajax
- DB Query not working in Plugin
- Assign all Post in Wp to a specific Category
- External wpdb connections in different plugins on single page
- Loop returns the current page’s permalink and guid instead of the post in the loop