mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
Prepare DB queries in more places. Props filosofo. see #6644
git-svn-id: https://develop.svn.wordpress.org/trunk@7645 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -8,7 +8,7 @@ if(!function_exists('get_comment_count'))
|
||||
function get_comment_count($post_ID)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ if(!function_exists('link_exists'))
|
||||
function link_exists($linkname)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user