№ | Пользователь | Очки |
---|---|---|
=$user['top'];?> | =$user['name'];?> | =$user['score'];?> |
| =$i;?> |
prepare("SELECT `user`.`id`, `user`.`name`, SUM(`bet`.`score`) AS `score` FROM `user` LEFT JOIN `bet` ON `bet`.`user_email` = `user`.`email` WHERE `bet`.`competition` = :id GROUP BY `id`"); $sth->execute(array(':id' => $_GET['competition'])); $users = $sth->fetchAll(); $count = count($users); $sth = $db->prepare("SELECT `user`.`id`, `user`.`name`, SUM(`bet`.`score`) AS `score` FROM `user` LEFT JOIN `bet` ON `bet`.`user_email` = `user`.`email` WHERE `bet`.`competition` = :id GROUP BY `id` ORDER BY `score` DESC LIMIT $from, $pagination"); $sth->execute(array(':id' => $_GET['competition'])); $users = $sth->fetchAll(); $users_pages = ceil($count/$pagination); for($i = 0; $i < count($users); $i++){ if($from == 0){ $from_top = 1; }else{ $from_top = $from + 1; } $users[$i]['top'] = $i + $from_top; } } ?>
=$banner_1;?>, |
=$banner_3;?>