【发布时间】:2018-07-14 05:40:43
【问题描述】:
我正在尝试删除我的主表“eleve”,同时删除其他主键在此表中的表。我在附加代码中尝试过,但出现错误:
(Erreur de syntaxe pr�s de 'from bource where ID_BOURCE = 1delete from class where ID_CLASS = 1delete from p' � la ligne 1)
有什么想法吗?
if (isset($_POST['butAj4'])) {
$queryDel = "delete from inscription where NUM_INSCRIPTION = $NUM_INSCRIPTION";
$queryDel. = "delete from bource where ID_BOURCE = $ID_BOURCE";
$queryDel. = "delete from class where ID_CLASS = $ID_CLASS";
$queryDel. = "delete from project where ID_PROJECT = $ID_PROJECT";
$queryDel. = "delete from annee_scolaire where ID_ANNEE = $ID_ANNEE";
$queryDel. = "delete from eleve where CIN_ELEVE = '$InputCIN'";
if (mysqli_multi_query($con, $queryDel)) {
$msg3 = "<div class='alert alert-success'>Bien suppression</div>";
} else {
$msg3 = "<div class='alert alert-danger'>error dans la suppression</div>".mysqli_error($con);
}
}
【问题讨论】:
-
不要使用多查询,这几乎总是一个坏主意
-
@rtfm 好的,我将为每个表进行单个查询
-
这应该可以,您只是忘记了每个查询末尾的
;。例如:"delete from eleve where CIN_ELEVE = '$InputCIN';"
标签: php mysql mysqli mysqli-multi-query