php与数据库查询值时,返回显示值时少了一条是怎么回事?
<?phpinclude("conn.php");$sql="select*formaaa";$sql="SELECT*FROM`aaa`orderbyiddesc";$...
<?php
include("conn.php");
$sql = "select * form aaa";
$sql = "SELECT * FROM `aaa` order by id desc ";
$query = mysql_query($sql);
$row = mysql_fetch_array($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>无标题文档</title>
</head>
<body>
<table width="800" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#00FFFF">
<?php
while($row1 = mysql_fetch_array($query))
{
?>
<tr bgcolor="#0099FF">
<td>标题:<?php echo $row1['title']; ?> 用户:<?php echo $row1['user'];?></td>
</tr>
<tr bgcolor="#CCCCCC">
<td><?php echo $row1['content']?></td>
</tr>
<?php
}
?>
</table>
</body>
</html> 展开
include("conn.php");
$sql = "select * form aaa";
$sql = "SELECT * FROM `aaa` order by id desc ";
$query = mysql_query($sql);
$row = mysql_fetch_array($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>无标题文档</title>
</head>
<body>
<table width="800" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#00FFFF">
<?php
while($row1 = mysql_fetch_array($query))
{
?>
<tr bgcolor="#0099FF">
<td>标题:<?php echo $row1['title']; ?> 用户:<?php echo $row1['user'];?></td>
</tr>
<tr bgcolor="#CCCCCC">
<td><?php echo $row1['content']?></td>
</tr>
<?php
}
?>
</table>
</body>
</html> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询