我正在尝试创建一个页面,在网页上显示来自 mysql 数据库的 rpg 排名
我进入数据库并按级别组织数据,因此首先显示级别最高的人,依此类推,但是数据库不包含排名表
我正在尝试在 Dreamweaver 中手动执行此操作,但我不知道如何,我可以创建一个计数器并将其显示在表格中吗?
我设法得到以下信息: http ://slayersgaming.com/rpgranks2.php
<?php
$dbh=mysql_connect("********", "**********", "*********") or die('Cannot connect to the database because: '. mysql_error());
mysql_select_db("C368969_thcrpgCSGO");
$rpgranks_sql = "SELECT * FROM `thc_rpg` ORDER BY `thc_rpg`.`level` DESC LIMIT 0, 30 ";
$rpgranks_query = mysql_query($rpgranks_sql) or die(mysql_error());
$rsrpgranks = mysql_fetch_assoc($rpgranks_query);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<p>
<table width="501" height="58" border="0">
<tr>
<td width="240"><h2><strong>Name</strong></h2></td>
<td width="70"><strong>Level</strong></td>
<td width="70"><strong>XP</strong></td>
<td width="70"><strong>Credits</strong></td>
<td width="70"><strong>Rank</strong></td>
</tr>
</table>
<?php do{ ?>
<table width="501" height="58" border="0">
<tr>
<td width="240"><?php echo $rsrpgranks['name'];?></td>
<td width="70"><?php echo $rsrpgranks['level'];?></td>
<td width="70"><?php echo $rsrpgranks['xp'];?></td>
<td width="70"><?php echo $rsrpgranks['credits'];?></td>
<td width="70"> </td>
</tr>
</table>
<?php } while ($rsrpgranks = mysql_fetch_assoc($rpgranks_query)) ?>
</p>
<p> </p>
</body>
</html>
屏幕截图:http: //oi47.tinypic.com/21exdfs.jpg