WordPress.org

Ready to get started?Download WordPress

Forums

Problems with $wpdb (2 posts)

  1. Matt
    Member
    Posted 5 years ago #

    <?php $numvrd = $wpdb->query("SELECT SUM(wp_term_taxonomy.count) FROM wp_term_taxonomy where wp_term_taxonomy.term_id in (73,74)"); echo($numvrd); ?>

    Running that query in a MySql query editor returns 425.

    The code above - in a WP footer - returns 1.

    It's exactly the same in both. Any ideas?

  2. Matt
    Member
    Posted 5 years ago #

    Ack, I was using $wpdb incorrectly. I did the above, but instead of $wpdb->query I used $wpdb->get_var and it returns 425.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags