繁体   English   中英

我初始化了一个数字,将其串联在一个html字符串中,但是它不起作用

[英]I initialized a number, I concatenated it in an html string, but it doesn't work

我一直在尝试建立一个“排名”系统。 如果表上的第一个是1,那么第二个是2; 我已经完成了一半,但是遇到了问题。

do {
   echo "The number is ".$i."<br/>";
   $i++;
} 
while ($i <= 5);

        while( $row = mysql_fetch_assoc( $result ) ){
             $uuid = $row['UUID'];
             $kills = $row['KILLS'];
             $deaths = $row['DEATHS'];
             $wins = $row['WINS'];
             $points = $row['POINTS'];
             $crystals = $row['CRYSTALS'];
             echo
             "<tr>
               <td>The number is ".$i."</td>

那是我当前的代码,这是输出: 我的排行榜

因此,它在表外运行,但是一旦在表中似乎保持相同的值。 我在想,也许是因为整个表都设置在一个预设行上,但是它可以与其他与php相关的东西很好地工作,所以为什么不使用它呢?

首先将$ i设置为0,然后每转一圈增加该值,这是经过编辑的代码:

do {
   echo "The number is ".$i."<br/>";
   $i++;
} 
while ($i <= 5);

$i = 0;
        while( $row = mysql_fetch_assoc( $result ) ){
             $i++;
             $uuid = $row['UUID'];
             $kills = $row['KILLS'];
             $deaths = $row['DEATHS'];
             $wins = $row['WINS'];
             $points = $row['POINTS'];
             $crystals = $row['CRYSTALS'];
             echo
             "<tr>
               <td>The number is ".$i."</td>

我的代码正确,只需要通过编辑以下代码来增加表中的数字:

<td>".$i."</td>

对此:

<td>".$i++."</td>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM