<分区>
我正在为学校类(class)做一个计算项目。它涉及 PHP、MySQL 和 HTML - 本质上是构建基于 Web 的应用程序。
我在名为“cp11641_users”的数据库中有一个名为“users”的 PHP 表 此表的内容已使用以下 mysql_query 回显到 html 表中:
<div id='accordion'> <ul>
<li>
<a href='#one'><h4>Edit User Table</h4></a>
<div id='one' class='accordion'>";
$query = "SELECT * FROM users"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='container'>"; // start a table tag in the HTML
echo " <thead> <tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Username</th>
<th>Edit</th> </tr> </thead> ";
echo "<tbody>";
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr><td>" . $row['first'] . "</td><td>" . $row['last'] . "</td><td>" . $row['username'] . "</td><td>" . "edit" . "</td></tr>"; }
echo "</tbody> </table>"; //Close the table in HTML
echo "</div>
</li>";
这显然是把PHP表格的内容放到了HTML表格中去查看。但我希望能够单击 html 表中每一行旁边的“编辑”选项卡,并能够对该行中的数据进行更改/修改/删除。
这是管理员页面,应该能够为每个用户更改特定详细信息,这基本上就是我想要做的。
我在想我需要利用 while 循环使用一个数组这一事实,我可以从中提取特定的数据行(即 $Row[1]),然后将其放入 $_POST[]?我不确定