php - 在mysql while函数中指定序列号

标签 php mysql while-loop autonumber

while ($one = mysql_fetch_array($two)) {
<td>Want Serial No Here</td> 
<td><?=$something['something']?></td>
}

我想自动编号序列号..可以吗?

最佳答案

我的印象是您正在尝试为每一行生成连续的数字:

<?php

$count = 0;
while($row = mysql_fetch_assoc($res)){
    $count++;

    echo '<tr><td>' . $count . '</td><td>' . htmlspecialchars($row['name']) . '</td></tr>';
}

关于php - 在mysql while函数中指定序列号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4510910/

相关文章:

php - 带连接的 SQL 查询仅显示一个结果

php - 每n天发送一次邮件

java - 如何动态更改 sql 'like' 运算符?

MySQL InnoDB 快速索引创建不起作用

java - 需要在类中实现do、while循环

php - 使用 javascript 渲染 DIV

php - Yii2:根据相关表中的另一个字段自动填充字段

mysql - 数据库 : A table for each language or one table with a language column

java - 外部类java中的While循环

java - 索引像素来为图片的某些位置着色