Home  >  Article  >  Backend Development  >  PHP與mysql的問題解决方案

PHP與mysql的問題解决方案

WBOY
WBOYOriginal
2016-06-13 11:33:16801browse

PHP與mysql的問題
如圖


想要在這個mysql_result.php網頁中加入刪除使用者帳號密碼的功能,將他改變如下圖,讓他能夠點擊[刪除]
這個超連結,就能刪除掉那一行的值




請問各位要怎麼做呢??

以下是mysql_result.php的源碼

<html><br />  <head><br />    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  <br /><title>顯示所有記錄</title><br />  </head><br />  <body><br />    <h1 align="CENTER">帳號密碼顯示表</h1><br />    <?php<br />      require_once("mysql.php");<br />      $link = create_connection();<br />      $sql = "SELECT no AS '編號',username AS '帳號',password AS '密碼' FROM root";<br />      $result = execute_sql("os", $sql, $link);<br />      echo "<table border='1' align='center'><tr align='center'>";<br />      for ($i = 0; $i < mysql_num_fields($result); $i++) <br />    echo "<td>" . mysql_fetch_field($result, $i)->name. "</td>";		<br />     echo "</tr>";<br />      for ($j = 0; $j < mysql_num_rows($result); $j++)    <br />            {<br /><br />        echo "<tr>";				<br />        for ($k = 0; $k < mysql_num_fields($result); $k++)<br />          echo "<td>" . mysql_result($result, $j, $k) . "</td>";<br /><br />        echo "</tr>";				<br />      }<br />      echo "</table>" ;<br />      mysql_free_result($result);<br />      mysql_close($link);<br />    ?> <br />  </body><br /></html>



然後還有mysql.php這個必要檔案的源碼

<br><?php <br />function create_connection()<br>{<br>$link = mysql_connect("localhost","root","")<br>or die("無法連接" . mysql_error());<br><br>mysql_query("SET NAMES utf8");<br><br>return $link;<br>}<br>function execute_sql($database,$sql,$link)<div class="clear">
                 
              
              
        
            </div>
Statement:
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