mysql-php从数据库中读取某个表中的数据并在页面中一条条列出来,代码如下,数据库里有信息,显示不出来

Posted on

mysqlphp

  <?php        
include("connectDB.php");
@$query=mysql_query($con,"SELECT * from xx");
@$result=mysql_fetch_array(@$query);
if($result==true){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">暂无信息!</td>
</tr>
</table><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="13%">
<a href="newxx.php">插入信息</a>
<td width="13%">
<a href="query.php">查询信息</a>
</td>
</tr></table>
<?php}else{?>
<table width="90%" height="70%" border="0" cellspacing="0" cellpadding="0">
<tr>

<td width="13%">
<a href="newxx.php">插入信息</a>
</td>
<td width="13%">
<a href="query.php">查询信息</a>
</td> </tr></table>
<table width="80%" height="70%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF"
bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF"> <br> <br> <br>
<tr align="center"><td align="center">信息</td>
</tr></table><table width="90%" height="70%" border="3" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF"
bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF"> <tr align="center" bgcolor="#e3F4F7">
<td width="10%" bgcolor="#e3F4F7">信息id</td>
<td width="30%" bgcolor="#e3F4F7">信息内容</td>
<td width="14%" bgcolor="#e3F4F7">查看</td> <td width="10%" bgcolor="#e3F4F7">修改</td>
</tr><?php//循环显示数据库信息do{ ?> <tr>
<td style="padding:5px;" bgcolor="#e3F4F7" align=center>&nbsp;
<?php echo $result['xxid'];?></td>
<td style="padding:5px;" bgcolor="#e3F4F7" align=center>&nbsp;
<?php echo $result['xxnr'];?></td>
<td align="center" bgcolor="#e3F4F7"><a href="show.php?$xxid=<?php echo $result['xxid'];?>">查看</a></td>
<td align="center" bgcolor="#e3F4F7"><a href="updata.php?$xxid=<?php echo $result['xxid'];?>">修改</a></td>
</tr><?php}while(@$result=mysql_fetch_array($query));}?>

该文章由WP-AutoPost插件自动采集发布

原文地址:http://www.php.cn/php-weizijiaocheng-80314.html

Leave a Reply

Your email address will not be published. Required fields are marked *