使用php删除两个相关表中的数据

问题描述 投票:0回答:1
<?php
$conn = new mysqli("localhost", "root", "", "hcis") or die(mysqli_error());
$conn->query("DELETE FROM `itr` NATURAL JOIN `vaccine` WHERE `itr_no` = '$_GET[id]'") or die(mysqli_error());
header("location:patient.php");
?>

这是我的示例代码。我打算删除两个相关表中的数据,当我运行它时,我收到此错误:

警告:mysqli_error()期望在第3行的C:\ xampp \ htdocs \ thesis \ admin \ delete_patient.php中给出1个参数0

请帮助..我认为我的查询不正确。

php
1个回答
1
投票

你忘了在mysqli_error里传递你的连接对象只需要替换你的

mysqli_error()

mysqli_error($conn)

有关mysqli_error的更多信息,请参考here

© www.soinside.com 2019 - 2024. All rights reserved.