其实这是主要问题。它没有获得可以在这里用作条件的“$ radio [$ i]”语句的值。所以有人请告诉我在那里写的东西而不是“$ radio [$ i]”,因为输出会来。
<?php
if(isset($_POST['delete']))
{
for($i=0;$i<$count;$i++)
{
$del_id = $radio[$i];
$sql = "DELETE FROM reigster WHERE id='".mysql_real_escape_string($del_id)."'";
$result = mysql_query($sql);
}
if($result)
{
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">";
}
}
mysql_close();
?>
答案 0 :(得分:0)
查看上一个问题之后问题出现在这段代码
中for($i=0;$i<$count;$i++)
{
$del_id = $radio[$i];
$sql = "DELETE FROM reigster WHERE id='".mysql_real_escape_string($del_id)."'";
$result = mysql_query($sql);
}
将上面的代码替换为
$count=count($_POST['radio']);
for($i=0;$i<$count;$i++)
{
$del_id = $_POST['radio'][$i];
$sql = "DELETE FROM reigster WHERE id='".mysql_real_escape_string($del_id)."'";
$result = mysql_query($sql);
}
答案 1 :(得分:0)
foreach($_POST['radio'] as $del_id)
{
$sql = "DELETE FROM reigster WHERE id='".mysql_real_escape_string($del_id)."'";
$result = mysql_query($sql);
}
答案 2 :(得分:0)
试试这个
if(isset($_POST['delete']))
{
for($i=0;$i<$count;$i++)
{
$del_id = $radio['checked'];
$sql = "DELETE FROM reigster WHERE id='".mysql_real_escape_string($del_id)."'";
$result = mysql_query($sql);
}
if($result)
{
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.