I am new to wordpress development & tried to learning plugin development.I have created a custom table from which i want to show the number of records found.I have tried the below code but it always shows 1 as a result irrespective of number of rows in a table.
//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);
$num = $wpdb->num_rows;
echo $wpdb->num_rows . 'Rows Found';
}