我從MySQL數據庫中獲取數據...我想檢查每一行的索引... 例如
while($row=mysql_fetch_array($result)
{
i want index of $row in each row... (current Index).
}
請幫幫我。 謝謝
我從MySQL數據庫中獲取數據...我想檢查每一行的索引... 例如
while($row=mysql_fetch_array($result)
{
i want index of $row in each row... (current Index).
}
請幫幫我。 謝謝
如果您想要數據庫中的索引:
<?php
...
$result = mysql_query("SELECT * FROM whatever");
while($row = mysql_fetch_array($result)) {
echo $row['index'];
# Where index is the field name containing the item ID from your database
}
...
?>
或者,如果要根據輸出計算項目數:
<?php
..
$result = mysql_query("SELECT * FROM whatever");
$index = 0;
while($row = mysql_fetch_array($result)) {
echo $index.' '.$row['whatever'];
$index++;
}
..
?>
這就是我從你的問題中理解的......