mysql_query SELECT FROM user ORDER BY karma DESC str while mysql_fetch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
$q = mysql_query("SELECT * FROM `user` ORDER BY `karma` DESC");
$str = "";
while ($a = mysql_fetch_array($q))
{
$info = json_decode(vk("users.get", array(
"user_ids" => $a["uid"]
)) , true);
$info = $info["response"];
foreach($info as $v)
{
$name = $v["first_name"] . " " . $v["last_name"];
}
$str.= "Карма " . $name . " составляет " . plural($a["karma"], 'голос', 'голоса', 'голосов') . ".\n";
}
send($chat_id, $str);