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
- Is it bad practice to create own table for a plugin?
- Is there a plugin that will override the “Error establishing a database connection” message? [closed]
- What are these entries in the database? Looks similar to JSON
- How to properly insert data into custom table via plugin
- WP_query parameters for date range
- How does WordPress handle MySQL row lock errors?
- How to empty wordpress custom post Database table
- $wpdb->get_results leaking memory
- Is it a bad practice to go directly to the mysql database while developing a plugin?
- Custom database table for plugin not creating on activation
- Comparisson between date() and a date from wp_postmeta
- How to extract images of post and pages excluding header and logo image in wordpress?
- Add agenda items and notifications
- Taking WordPress table prefixes into account
- Changing BIGINT to INT
- WordPress register_activation_hook table creation not working
- How to add Edit | Delete button on rows?
- The plugin generated x characters of unexpected output, $wpdb not defined
- Can I run multiple queries with $wpdb->prepare?
- greatest() function returns undefined property
- Get total number of comment of the posts written by an author
- WP_Query ordering numbers as letters
- Unable to create new database table upon plugin activation using dbDelta
- Saving Custom Post types and fields to a custom table
- WooCommerce shop page orderby [closed]
- When to use action hooks and plugins
- Plugin Options Not Saving to Database in WP 4.5
- Not getting author rank when using return
- Access WordPress database outside of WordPress
- How to create custom tables in WordPress using my own plugin?
- Help With MySQL to WPDB Query Conversion
- How can I perform high-level database merging for WordPress within continues delivery?
- How to remove traces from widget during uninstallation
- Migrating to WordPress Recipe Plugin and Some SQL Issues
- Multiple instance of data in plugin custom database table on plugin activation
- Using AJAX to generate front end / viewer end pages
- WordPress plugin creating database in localhost but not on real host
- “Master” WordPress Multisite – Database Sync
- WooCommerce search products between price range using WP_Query
- Does deleting a Plugin via the WordPress admin ‘completely’ remove the code?
- WPDB: Update table
- How to Loop Through all Posts and Count Attachments using Get Media Attachments
- How to keep variable `$post` to using in another file
- Making my plugin create a page?
- Add some fileds to the wp_posts table
- Best/Correct way to add an option to a category
- Error in pdf generating plugin using FPDF
- Return multiple values in a shortcode attribute
- Always get creating a new table with foreign key
- DB Query not working in Plugin
- Loop returns the current page’s permalink and guid instead of the post in the loop
- Add user meta after a user has registered and logged In [closed]
- Where do plugin variables live in the db?
- How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?
- Plugin: connect to external database without showing password
- Storing Form data in a different database
- Pagination not working
- How to add a custom form to a plugin’s setting page
- update_option creates an option, which empties on a blog reload
- How to find the WordPress Nextgen galleries which are not used in WordPress posts?
- More than one WordPress site using the same database – how to disable plugin for one site?
- How to search post titles with whole words only, but not the exact word only?
- Use get_pages() before another plugin modifies it
- How to Join wp_posts & wp_postmeta table using custom query
- Can i stream data to a custom_post_type?
- How do I add a medium to the WordPress database with my own plugin?
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- Get Shortcode output to database for static post_content
- My wp database has been hacked
- How to update a database entry with a wordpress plugin?
- How can I store user preferences in WordPress and retreive them later?
- How to use information from the database in the front-end?
- Enable plugins that are “not supported”
- ACF Query result in a new td (echo)
- one admin for 2 wordpress websites
- My plugin can’t see my files
- History of page, interval of years
- Need help for creating custom table on wordpress
- Show a table from data submitted by a form from a user
- Plugin does not create a custom table upon activation
- WordPress filter function using query modifications
- WP-Snap too slow (caused by WP_Query?)
- WordPress Meta Query: Relation is not working correctly
- WordPress ultra slow if I click on posts?
- Checking url from plugin [duplicate]
- Managing database tables in WordPress multisite
- Creating fields in the database
- How to submit the custom form data in database in WordPress without plugin?
- Duplicator live to wamp https to http
- Is it possible to recover Deleted users?
- User register hook can’t access form request
- I want to display data last 7 days with date wise in chartjs?
- Does anyone recognize these table names?
- Edit a page/post DB data?