如果我提交在错误行中生成的以下 SQL 表明它运行良好,但在 PHP 中它告诉我“查询为空”。
知道为什么吗?
例如生成的字符串如下:
update LOTS set packageID = "" where packageID ='AS0610'
如果我按照我所说的那样手动提交此查询,则没有错误。我试过用“”代替“”,但似乎并没有解决问题。
<?
$delID = stripslashes($_COOKIE['delID']);
$delType = $_COOKIE['delType'];
$conn=mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
echo $conn;
if($delType=="packageID"){
$sqlLots = 'update LOTS set packageID = "" where packageID ='.$delID;
echo $sqlLots;
//returns "Quer was empty" on below line.
$result = mysql_query($sqlLOTS) or die(mysql_error());
$sqlLOTS = 'delete from PACKAGES where '.$delType.' = '.$delID;
}else{
$sqlLOTS = 'delete from LOTS where '.$delType.' = '.$delID;
}
$result = mysql_query($sqlLOTS); //or die(mysql_error());
echo "<html>";
echo "<script>";
echo "window.location = 'http://www.redIR.info/manage/index.php'";
echo "</script>";
echo "</html>";
echo 'a'.$result;
?>