mysql-php從資料庫中讀取某個表中的資料並在頁面中一條條列出來,代碼如下,資料庫裡有資訊,顯示不出來

來源:互聯網
上載者:User
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));}?>
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.