WordPress.org

Make WordPress Core

Changeset 12122


Ignore:
Timestamp:
10/28/2009 03:10:59 AM (9 years ago)
Author:
azaozz
Message:

Fix possible bad query, props aaroncampbell, see #4529

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r12116 r12122  
    769769    $where = '';
    770770    if ( $post_id > 0 )
    771         $where = $wpdb->prepare( "comment_post_ID = %d AND ", $post_id );
     771        $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id );
    772772
    773773    $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
Note: See TracChangeset for help on using the changeset viewer.