Rumah > Artikel > pembangunan bahagian belakang > PHP與mysql的問題解决方案
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>
<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>