尝试使用PHP中的删除按钮从表中删除行
问题描述:
<pre><?php
include 'conn.php';
$result = ("SELECT * FROM usrdata"); // selecting data through mysql_query()
$count=mysqli_query($conn,$result);
echo'<table border=1px>'; // opening table tag
echo'<th>id</th><th>email</th><th>Password</th>'; //table headers
while($data = mysqli_fetch_array($count))
{
// we are running a while loop to print all the rows in a table
echo'<tr>'; // printing table row
echo '<td>'.$data['id'].'</td><td>'.$data['email'].'</td><td>'.$data['password'].'</td>'; // we are looping all data to be printed till last row in the table
echo '<td><input type="button" name="delete" value="delete"></td>';
}
echo'</tr>'; // closing table row
echo '</table>';
if($_GET){
if(isset($_GET['delete'])){
delete();
}//elseif(isset($_GET['select'])){
//select();
//}
}
function delete()
{
$delete1 =("DELETE FROM `usrdata` WHERE id = '$id'");
$result = mysqli_query($conn,$delete1) or die(mysqli_error());
echo "record deleted";
}
?>
我尝试过的事情:
我尝试使用按钮单击将整个行删除到表中.但是按钮已响起事件没有响应
What I have tried:
i am try to delete entire row into table using button click. but button is clikced event is dosen''t responsed
答
结果 =(" SELECT * FROM usrdata"); // 通过mysql_query()选择数据
count = mysqli_query (
count=mysqli_query(
conn,