当我运行我的代码时,我收到此错误:
我已经在我的服务器上测试了SQL并且它正确,这让我相信它是循环不正确。
我知道接下来要解决的安全问题。
if(isset($_GET['rowID']))
{
$sql = 'DELETE FROM table WHERE id="' . $_GET['rowID'] . '";';
echo "<b>ECHO SQL<b><br>";
echo $sql;
if (mysqli_query($connection, $sql))
{
echo "Record deleted successfully";
}
else
{
echo "<br> Error deleting record: " . mysqli_error($connection);
}
}
答案 0 :(得分:0)
在第3行使用正确的GET变量rowID
代替row
:
if(isset($_GET['rowID']))
{
$sql = 'DELETE FROM table WHERE id="' . $_GET['rowID'] . '";';
echo "<b>ECHO SQL<b><br>";
echo $sql;
if (mysqli_query($connection, $sql))
{
echo "Record deleted successfully";
}
else
{
echo "<br> Error deleting record: " . mysqli_error($connection);
}
}