php和数据库结合的一个简单的web实例 代码分析(5)


  <html>
  <head><title>Deleting an entry from the database</title>
  </head>
  <body bgcolor=#ffffff>
  <h1>Del an entry</h1>
  <?
  mysql_connect() or die ("Problem connecting to DataBase");
  $query = "select * from tbl";
  $result = mysql_db_query("example", $query);
  if ($result)
  {
  echo "Found these entries in the database:<br><p></p>";
  echo "<table width=90% align=center border=1><tr>
  <td align=center bgcolor=#00ffff>idx</td>
  <td align=center bgcolor=#00FFFF>User Name</td>
  <td align=center bgcolor=#00FFFF>Last Name</td>
  <td align=center bgcolor=#00FFFF>Free Text</td>
  </tr>";
  while ($r = mysql_fetch_array($result))
  {
  $idx = $r["idx"];
  $user = $r["UserName"];
  $last = $r["LastName"];
  $text = $r["FreeText"];
  echo "<tr>
  <td align=center>
  <a href=https://www.jb51.net/article/\"dele.php3?
  idx=$idx&UserName=$user&LastName=$last&FreeText=$text\">$idx</a></td>
  <td>$user</td>
  <td>$last</td>
  <td>$dtext</td>
  </tr>";
  }
  echo "</table>";
  }
  else
  {
  echo "No data.";
  }
  mysql_free_result($result);
  include ('links.x');
  ?>
  </body>
  </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2101914dd6bd88a0e81765f2a7439c47.html