为什么我不能按最后更改的等级写行号

时间:2018-11-26 00:22:33

标签: php pdo

我想按得分来写行号。但是我无法做到这一点。

    <?php
               $self=$db->query("SELECT * FROM table ORDER BY exam_name DESC");
               $a1=1;
               foreach ($self as $order)
               {

                   if($order['exam_name']==$gb['exam_name']) //$gb = selected exam by user id

                   {
                       echo $a1;
                       break;

                   }
                   $a1++;

               }
    ?>

0 个答案:

没有答案