<?php
//Connect to DB
$dbcnx = @mysql_connect("$db_host", $db_user, "$db_password");
if (!$dbcnx) {
echo("<P>Unable to connect to the " .
"database server at this time.</P>");
exit();
}
mysql_select_db("daily_audit", $dbcnx);
// Request the text of all the hosts
if(!empty($_POST['checklist'])) {
foreach($_POST['checklist'] as $check) {
$result = mysql_query(
"DELETE FROM hosts_list WHERE IP_Address = %s ", $check);
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
}
}
?>
我有一個問題需要運行下面的代碼。我已經確認_POST變量包含數據,但我確信我的SQL查詢正在處理中存在問題。對不起,我是一個PHP n00b,我正試圖瞭解如何解決此問題。我知道查詢可能需要在IP地址周圍進行這個棘手的問題。感謝所有提前。將_POST變量傳遞給Mysql WHERE子句
究竟是什麼問題? – andrewsi