Which of the two following queries might be faster?
$cposts = mysql_query("SELECT id FROM posts WHERE company_id = ".$dealid." ");
$sum_posts= mysql_num_rows($cposts);
echo $sum_posts;
or
$cposts2 = mysql_query("SELECT count(id) as myid FROM posts WHERE company_id = ".$dealid." ");
$sum_posts2= mysql_fetch_assoc($cposts2);
echo $sum_posts2['myid'];
I believe the count would be better, and will use less processing.
I would go with this: