我需要检查数据库中是否存在 ID,以便删除它,如果不存在则显示消息警告。将“x”与“xtrue”进行比较时出现问题。
$x = $_REQUEST['X'];
$y = $_REQUEST['Y'];
if($x != "") {
$xtrue = " SELECT x
FROM ".$y."
WHERE x=".$x;
if($x == $xtrue) {
$query="DELETE FROM ".$y." WHERE id=".$x;
$recordset = mysql_query($query,$conn);
echo "-> ".$x." from ".$y." deleted.";
}
else{echo "There is no ".$x." from ".$y.".";}
}