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

不言
Release: 2023-02-28 11:08:01
Original
1910 people have browsed it

       mysqlphp

<code>  <?php        <br/>  include("connectDB.php");        <br/>  @$query=mysql_query($con,"SELECT * from xx");        <br/>  @$result=mysql_fetch_array(@$query);        <br/>  if($result==true){        <br/>  ?>           <br/>  <table width="100%" height="30"  border="0" cellpadding="0" cellspacing="0">            <br/>  <tr>              <br/>  <td height="36" align="center">暂无信息!</td>            <br/>  </tr>          <br/>  </table><table width="100%"  border="0" cellspacing="0" cellpadding="0"><br/>    <tr><br/>        <td width="13%">      <br/>        <a href="newxx.php">插入信息</a>    <br/>        <td width="13%">      <br/>        <a href="query.php">查询信息</a>    <br/>        </td><br/>          </tr></table> <br/>          <?php}else{?><br/>           <table width="90%"  height="70%" border="0" cellspacing="0" cellpadding="0"><br/>             <tr><br/>                 <br/>            <td width="13%">     <br/>            <a href="newxx.php">插入信息</a>   <br/>            </td> <br/>            <td width="13%">     <br/>            <a href="query.php">查询信息</a><br/>            </td>  </tr></table>  <br/>            <table width="80%" height="70%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF"          <br/>           bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">         <br>         <br>         <br>         <br/>          <tr align="center"><td align="center">信息</td><br/>           </tr></table><table width="90%" height="70%"  border="3" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF"         <br/>          bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">  <tr align="center" bgcolor="#e3F4F7">    <br/>          <td width="10%" bgcolor="#e3F4F7">信息id</td>      <br/>         <td width="30%" bgcolor="#e3F4F7">信息内容</td>    <br/>         <td width="14%" bgcolor="#e3F4F7">查看</td>    <td width="10%" bgcolor="#e3F4F7">修改</td><br/>        </tr><?php//循环显示数据库信息do{ ?>  <tr>    <br/>        <td style="padding:5px;" bgcolor="#e3F4F7" align=center> <br/>        <?php echo $result[&#39;xxid&#39;];?></td>      <br/>       <td style="padding:5px;" bgcolor="#e3F4F7" align=center> <br/>       <?php echo $result[&#39;xxnr&#39;];?></td>      <br/>       <td align="center" bgcolor="#e3F4F7"><a href="show.php?$xxid=<?php echo $result[&#39;xxid&#39;];?>">查看</a></td>    <br/>       <td align="center" bgcolor="#e3F4F7"><a href="updata.php?$xxid=<?php echo $result[&#39;xxid&#39;];?>">修改</a></td>  <br/>       </tr><?php}while(@$result=mysql_fetch_array($query));}?>  <br/>        </code>
Copy after login

       

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template