儘管彈出了一條錯誤消息,但我的php代碼正在成功執行。該代碼刪除一行從我的一個表,但會顯示以下錯誤信息:儘管「SQL語法錯誤」消息成功執行
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1
我的PHP代碼如下:
<?php
$id = $_GET['meeting_id'];
$username = $_GET['username'];
$result = mysql_query("DELETE FROM attendees WHERE meeting_id = '$id' AND username = '$username'")
or die(mysql_error());
if (!mysql_query($result))
{
die('Error: ' . mysql_error());
}
else
{
echo '<h2>The User Has Been Removed From The Meeting</h2>';
}
?>
任何人都可以在這裏看到的解決方案? 謝謝
你的代碼是SQL注入攻擊敞開的。 – 2012-01-05 20:09:12
看來'meeting_id'是一個整數類型的列,因此'$ 1'沒有引號。第二:這個代碼是_highly_ insecure!驗證_any_輸入!最後:回答查詢,看看結果如何。 – KingCrunch 2012-01-05 20:09:52
http://php.net/manual/en/security.database.sql-injection.php – 2012-01-05 20:10:35