我需要在 html 表中显示 mysql 数据。我目前使用的方法有点快速修复,有点笨拙,有人能解释一下正确的方法吗?
<?php
$a= mysql_query ("SELECT * FROM document WHERE email='$semail' ORDER BY id ASC LIMIT
");
$b= mysql_query ("SELECT * FROM document WHERE email='$semail' ORDER BY id ASC LIMIT
1 OFFSET 1 ");
$c= mysql_query ("SELECT * FROM document WHERE email='$semail' ORDER BY id ASC LIMIT
1 OFFSET 2 ");
if ($a = mysql_fetch_assoc($a));
if ($b = mysql_fetch_assoc($b));
if ($c = mysql_fetch_assoc($c));
?>
<html>
<table>
<tr>
<td><?php echo $a['col1']; ?></td>
<td><?php echo $a['col2']; ?></td>
</tr>
<tr>
<td><?php echo $b['col1']; ?></td>
<td><?php echo $b['col2']; ?></td>
</tr>
<tr>
<td><?php echo $c['col1']; ?></td>
<td><?php echo $c['col2']; ?></td>
</tr>
</table>
</html>