我不知道如何获取每个特定的ID并将其添加到以下查询中。
$id = '';
$del = '';
$del .="<form action=".$_SERVER['PHP_SELF']." method='POST'>";
$del .="<input type=\"submit\" name=\"delete\" value=\"Delete\" /></form>";
if(isset($_POST['delete'])){
$del_sql = "DELETE FROM users WHERE id=$id"; //i can't fetch id.
$del_qry = mysqli_query($link, $del_sql);
}
以下是从mysql获取和显示数据的代码。
$display_list = '';
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$id = $row['id'];
$name = $row['name'];
$email = $row['email'];
$display_list .= '<p>'.$id.'<br /> '.$name.'<br /> '.$email.' </p>'.'<p>'.$del.'</p>';
}