请指出对代码的修改,以便根据查询删除部分/所有行。
<?php
require_once ('config.php');
$mid = $_POST['mid'];
$pid = $_POST['pid'];
$sql = "DELETE * FROM assignment WHERE project_id = '$pid', member_id = '$mid'";
$retval = mysqli_query($connection, $sql);
if($retval)
{
die('Could not delete data: ' . mysqli_error());
}
echo "Deleted data successfully";
mysqli_close($connection);
?>
答案 0 :(得分:0)
删除,
并使用and
$sql = "DELETE * FROM assignment WHERE project_id = '$pid' and member_id = '$mid'";
答案 1 :(得分:0)
WHERE子句与AND
逻辑运算符一起使用时,仅在满足指定的所有过滤条件时执行。
$sql = "DELETE * FROM assignment WHERE project_id = '$pid' AND member_id = '$mid'";