mysql_query SELECT FROM strana_ot ORDER BY credit DESC while str mysql

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
$q = mysql_query("SELECT * FROM `strana_ot` ORDER BY `credit` DESC");
$i = 0;
while ($str = mysql_fetch_assoc($q)) {
$i++;
echo '<tr class="st_a" align="center">';
echo '<td>'.$i.'</td>';
echo '<td><b>'.html($str['strana_code']).' '.html($str['name_ru']).'</b></td>';
echo '<td>'.intval(mysql_result(mysql_query("SELECT COUNT(*) FROM `my_banner_statis_all` WHERE `data` = '". date("Y-m-d") ."' AND `strana` = '".html($str['strana_code'])."'"), 0)).'<br></td>';
echo '<td>'.round(mysql_result(mysql_query("SELECT COUNT(*) FROM `my_banner_statis_all` WHERE `data` = '". date("Y-m-d") ."' AND `strana` = '".html($str['strana_code'])."'"), 0) / (mysql_result(mysql_query("SELECT COUNT(*) FROM `my_banner_statis_all` WHERE `data` = '". date("Y-m-d") ."'"), 0)) * 100, 2).'%</td>';
echo '</tr>';
}