循环显示问题 ......没报错???你的while怎么没有结束的??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 噢,没注意少括号了,应该是这样的:<?while($row =mysql_fetch_array($result)) {$name =$row["name"];}?>这样只显示一条记录,怎么循环显示多条? 这样只能显示最后一条记录.循环显示要在循环中输出数据啊.<?php $conn=mysql_connect('localhost','root',""); $db=mysql_select_db('student',$conn); $result=mysql_query('select * from info'); ?><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>显示的数据</title><style type="text/css"><!--.style1 { font-size: 14px; font-weight: bold;}--></style></head><body> <?while($row =mysql_fetch_array($result)) {$name =$row["name"];?><table width="500" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"><span class="style1">查询的数据</span></td> </tr><tr align="center"> <td width="30" height="20"> 姓名</td> </tr><?while($row =mysql_fetch_array($result)) {$name =$row["name"];echo "<tr><td height="20"><?=$name ?></td></tr>";?></table></body></html> <?while($row =mysql_fetch_array($result)) {$name =$row["name"];?><table width="500" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"><span class="style1">查询的数据</span></td> </tr> <tr align="center"> <td width="30" height="20"> 姓名</td> </tr> <tr> <td height="20"><?=$name ?></td> </tr></table><?php}?></body></html> <?php $conn=mysql_connect('localhost','root',""); $db=mysql_select_db('student',$conn); $result=mysql_query('select * from info'); ?><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>显示的数据</title><style type="text/css"><!--.style1 { font-size: 14px; font-weight: bold;}--></style></head><body> <table width="500" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"><span class="style1">查询的数据</span></td> </tr><tr align="center"> <td width="30" height="20"> 姓名</td> </tr><?while($row =mysql_fetch_array($result)) {$name =$row["name"];echo "<tr><td height="20"><?=$name ?></td></tr>";}?></table></body></html>---------楼上的作废... mysql复制字段名问题 在线等一个简单问题 请问这段代码为什么不能控制 关于Linux下的lamp安装顺序 php 兼职 php生成随机颜色,并且相邻元素颜色不同 有一个文章列表,文章是列表是从数据库中读出标题,显示出来的,以前发布的文章都是动态链接 windows 下的apache 如何配置https 为什么连不上数据库 PHP安装要什么条件? php客户端调用.net的Web Service -----怎样实现 php编译
<?
while($row =mysql_fetch_array($result)) {
$name =$row["name"];
}
?>
这样只显示一条记录,怎么循环显示多条?
<?php
$conn=mysql_connect('localhost','root',"");
$db=mysql_select_db('student',$conn);
$result=mysql_query('select * from info');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示的数据</title>
<style type="text/css">
<!--
.style1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</head><body>
<?
while($row =mysql_fetch_array($result)) {
$name =$row["name"];
?><table width="500" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><span class="style1">查询的数据</span></td>
</tr>
<tr align="center">
<td width="30" height="20"> 姓名</td>
</tr>
<?
while($row =mysql_fetch_array($result)) {
$name =$row["name"];
echo "<tr><td height="20"><?=$name ?></td></tr>";
?>
</table>
</body>
</html>
while($row =mysql_fetch_array($result)) {
$name =$row["name"];
?><table width="500" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><span class="style1">查询的数据</span></td>
</tr>
<tr align="center">
<td width="30" height="20"> 姓名</td>
</tr>
<tr>
<td height="20"><?=$name ?></td> </tr>
</table>
<?php
}
?>
</body>
</html>
$conn=mysql_connect('localhost','root',"");
$db=mysql_select_db('student',$conn);
$result=mysql_query('select * from info');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示的数据</title>
<style type="text/css">
<!--
.style1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</head><body>
<table width="500" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><span class="style1">查询的数据</span></td>
</tr>
<tr align="center">
<td width="30" height="20"> 姓名</td>
</tr>
<?
while($row =mysql_fetch_array($result)) {
$name =$row["name"];
echo "<tr><td height="20"><?=$name ?></td></tr>";
}
?>
</table>
</body>
</html>---------
楼上的作废...