php复选框删除MySQL
<?php$con=mysql_connect("localhost","root","123456");if(!$con){die('Couldnotconnect:'...
<?php
$con = mysql_connect("localhost","root","123456");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM test_table");
echo "<table border='1'>
<tr>
<th>id</th>
<th>name</th>
<th>sex</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['sex'] . "</td>";
echo "<td>". '<input type="checkbox" name="'.$row['id'].'">' ."</td>";
echo "</tr>";
}
echo "</table>";
mysql_query("delete from table where id='$vaule[$i]'");
mysql_close($con);
?>
<input name="send" value="删除" type="submit" >
我想选中其中一项进行删除操作该怎么弄 展开
$con = mysql_connect("localhost","root","123456");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM test_table");
echo "<table border='1'>
<tr>
<th>id</th>
<th>name</th>
<th>sex</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['sex'] . "</td>";
echo "<td>". '<input type="checkbox" name="'.$row['id'].'">' ."</td>";
echo "</tr>";
}
echo "</table>";
mysql_query("delete from table where id='$vaule[$i]'");
mysql_close($con);
?>
<input name="send" value="删除" type="submit" >
我想选中其中一项进行删除操作该怎么弄 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询