<?php $i = 1; while($db->query("SELECT kredi FROM users WHERE kredi >= $kredi ORDER BY kredi DESC")){ $sira = $i; $i++; } echo $sira;