基本上正如我的问题所述,它适用于 phpmyadmin 但不适用于 php 本身。当我运行脚本时,它返回 true,并且不会死。帮助!
这是查询:
DELETE FROM selections WHERE selectorID = '$userID' AND selectedID = '$ID'
这是php脚本:
<?php
include_once "connect_to_mysql.php";
$errorB = false;
$error = '';
$id = '';
$userID = '';
if (empty($_GET['ID']) || empty($_GET['userID'])) {
$errorB = true;
if (empty($_GET['ID'])) {
$error = $error.'-No selected ID was sent';
}
if (empty($_GET['userID'])) {
$error = $error.'-No selector ID was sent';
}
} else {
$id = $_GET['ID'];
$userID = $_GET['userID'];
echo $id.$userID;
$sqlInsert = mysql_query("DELETE FROM selections WHERE selectorID = '$userID' AND selectedID = '$ID'") or die (mysql_error());
echo 'shz';
}
if ($errorB) {
echo $error;
}
?>
我的数据库如下所示:
id|selectorID|selectedID
3 1 4
4 1 5