在modelSlikeVrijednost
我有一个对model
-s 主键的引用。ModelSlikeVrijednost
可以包含很多图像(取决于用户)。我需要删除基于modelID
.
路径示例:/home/mainSite/public_html/site/img/1/1/
.
是否有可能做到这一点 ?
代码:
if ($stmt = $mysqli->prepare("SELECT modelID FROM model WHERE proizvodacID='$id'")) {
$stmt->execute();
$stmt->bind_result($modelID);
while ($stmt->fetch()) {
$path="/home/mainSite/public_html/site/img/".$id."/".$modelID."/";
if ($stmt1 = $mysqli->prepare("SELECT modelSlikeVrijednost FROM modelSlike WHERE modelID='$modelID'")) {
$stmt1->execute();
$stmt1->bind_result($slike);
while ($stmt1->fetch()) {
if(is_null($slike)){
rmdir($path);
}
else{
$slikePath="/home/mainSite/public_html/site/".$slike;
if($slikePath!=$path){
unlink($slikePath);
}
rmdir($path);
}
}
$stmt1->close();
}
else {
printf("Prepared Statement Error: %s\n", $mysqli->error);
}
}
$stmt->close();
}
我收到此错误:Prepared Statement Error: Commands out of sync; you can't run this command now Prepared Statement Error: Commands out of sync; you can't run this command now