WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
[resolved] How to display total count for all files? (4 posts)

  1. rguan
    Member
    Posted 2 years ago #

    Hello everyone,

    I want to display the total count number for all files, already tried the following codes but not working.

    1. The code displays nothing.

    <?php
        global $wpdb;
        $total_downloads = $wpdb->get_var("SELECT SUM(hits) FROM wp_download_monitor_stats ");
        echo $total_downloads;
    ?>

    2. The code displays "0".

    <?php
        global $wpdb;
        $total_downloads = $wpdb->get_var( $wpdb->prepare("SELECT SUM(hits) FROM wp_download_monitor_stats") );
        return number_format_i18n($total_downloads, 0, '.', ',');
    ?>

    Does anyone who have a solution?

    Thanks a lot!

    http://wordpress.org/extend/plugins/download-monitor/

  2. troelschristensen
    Member
    Posted 2 years ago #

    I would also like to see this working!

  3. AFillbrandt
    Member
    Posted 2 years ago #

    There is already a function for this.

    <?php
       	echo wp_dlm_get_total_files();
    ?>
  4. rguan
    Member
    Posted 2 years ago #

    Thanks for the code, finally sort it out with:

    <?php
       	echo wp_dlm_get_total_downloads();
    ?>

    Thanks a lot! :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic