The MU forums have moved to WordPress.org

Query Issue (3 posts)

  1. sobinbabue
    Member
    Posted 15 years ago #

    Hi All,

    I need a support in resolving mu query issue, I am pasting my query here,

    $users2 = $wpdb->get_var($wpdb->prepare('SELECT COUNT(posts.ID) FROM wp_posts posts, wp_users user WHERE user.ID = posts.post_author AND posts.post_date_gmt >= DATE_SUB(NOW(),INTERVAL 180 DAY) AND user.ID = '.$user1->ID.' GROUP BY posts.post_author'));

    When I print the query in user side it loads the user id and I copy paste that query in phpmyadmin and that pulls the result. But in code it is returning null result.

    I am trying to get count of posts for each users who had made a post in last 6 months. Please help to resolve this.

    Thanks
    Sobin Babu

  2. DeannaS
    Member
    Posted 15 years ago #

    So, just to clarify, if you print out the query with the #user1 var from your WPMU environment, and put it in phpmyadmin, you get the right answer?

    So, what are you doing with the $users2 variable to find out that it's a null result?

  3. sobinbabue
    Member
    Posted 15 years ago #

    Thanks for replaying Deannas,

    At first I thought the query is wrong. So just to clarify I tried the query in phpadmin and it pull result. But the query in WP code is not pulling any result. Please help to solve this.

    Thanks and Regards
    Sobin Babu

About this Topic

  • Started 15 years ago by sobinbabue
  • Latest reply from sobinbabue