我最近开始自己学习PHP,并开始使用MySQL和Apache。我在MySQL中创建了一个基本表,并且使用一些PHP代码,我在浏览器的HTML表格中显示了表格。现在我想在每行旁边添加一个删除按钮,点击后,它会删除该行。我对此很新,而且我只是在练习。任何人都可以帮我吗?这是我到目前为止的代码:PHP删除按钮
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
mysql_connect('localhost', 'root', '');
mysql_select_db('testdb');
$result = mysql_query('select * from products');
$numrows = mysql_numrows($result);
//****************************************************************
print "<table border = 3 style = width:400px>";
for($i = 0; $i < $numrows; $i++)
{
$row = mysql_fetch_row($result);
print "<tr>";
foreach($row as $cell)
{
print "<td>";
print $cell;
print "</td>";
}
print "</tr>";
}
print "</table>";
mysql_close();
?>
我也有一个delete.php
页面,但我真的不知道从哪里开始。我在寻找在线教程,许多人说不同的方式。
后的代码为您delete.php页为止。 – larsAnders
我最近回答了一个关于stackoverflow的问题,回答http://stackoverflow.com/questions/22241895/jquery-confirm-delete-with-onclick-issue/22245098#22245098,可能会让你受益。祝你好运。 – Bangash