Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
function loesche($id){
$SQL_select = "SELECT directoryID FROM directory WHERE Main_Directory = '".$id."'";
$result_select = mysql_query($SQL_select);
while($row = mysql_fetch_object($result_select))
{
mysql_query("DELETE FROM directory WHERE directoryID='".$row->directoryID."'");
mysql_query("DELETE FROM files WHERE dirID='".$row->directoryID."'");
$sql_delete_files=mysql_query("SELECT fileID FROM files WHERE dirID='".$row->directoryID."'");
while($delF = mysql_fetch_array($sql_delete_files));
{
$delFile= $delF["fileID"];
unlink("UPLOAD/".$delFile);
}
loesche($row->directoryID);
}
}
loesche($deleteID);
mysql_query("DELETE FROM directory WHERE directoryID='".$deleteID."'");
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\XAMPP\htdocs\test\del_dir.php on line 23
Warning: unlink(UPLOAD/) [function.unlink]: Permission denied in D:\XAMPP\htdocs\test\del_dir.php on line 26
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\XAMPP\htdocs\test\del_dir.php on line 23
Warning: unlink(UPLOAD/) [function.unlink]: Permission denied in D:\XAMPP\htdocs\test\del_dir.php on line 26
function loesche($id){
$SQL_select = "SELECT directoryID FROM directory WHERE Main_Directory = '".$id."'";
$result_select = mysql_query($SQL_select);
while($row = mysql_fetch_object($result_select))
{
mysql_query("DELETE FROM directory WHERE directoryID='".$row->directoryID."'");
$l="SELECT fileID,file_typ_s FROM files WHERE dirID='".$row->directoryID."'"."<br />";
$l_files=mysql_query("SELECT fileID,file_typ_s FROM files WHERE dirID='".$row->directoryID."'");
$l_l = mysql_fetch_object($l_files);
if($l_l->fileID!="")
{
unlink("UPLOAD/".$l_l->fileID.".".$l_l->file_typ_s);
}
else{
}
mysql_query("DELETE FROM files WHERE fileID='".$row->directoryID."'");
loesche($row->directoryID);
}
mysql_query("DELETE FROM directory WHERE directoryID='".$id."'");
$l_lll=mysql_query("SELECT * FROM files WHERE dirID='".$id."'");
$l_ll=mysql_fetch_object($l_lll);
if($l_ll->fileID!="")
{
unlink("UPLOAD/".$l_ll->fileID.".".$l_ll->file_typ_s);
mysql_query("DELETE FROM files WHERE dirID='".$id."'");
}
else{
mysql_query("DELETE FROM files WHERE dirID='".$id."'");
}
}
loesche($deleteID);
function loesche($dirId){
// Alle Unterverzeichnisse aus der DB auslesen
$subDirListSql = "SELECT directoryID FROM directory WHERE Main_Directory = '{$dirId}'";
$subDirListResult = mysql_query($subDirListSql);
while($subDir = mysql_fetch_object($subDirListResult)){
// Unterverzeichnisse im aktiven Unterverzeichniss löschen
loesche($subDir->directoryID);
// Alle Dateinamen im aktiven Unterverzeichniss auslesen
$fileListSql = "SELECT CONCAT(fileID, '.' ,file_typ_s) AS fileName FROM files WHERE dirID='{$subDir->directoryID}'";
$fileListResult = mysql_query($fileListSql);
while($file = mysql_fetch_object($resultFileList)){
// Dateipfad erstellen
$filePath = "UPLOAD/{$file->fileName}";
// prüfen ob die Datei exisitiert
if(file_exists($filePath)) {
// Datei löschen
unlink($filePath);
}
// Dateieintrag in der Datenbank löschen
$fileDeleteSql = "DELETE FROM files WHERE dirID='{$subDir->directoryID}'";
mysql_query($fileDeleteSql);
}
// Verzeichniss aus der Datenbank entfernen
$dirDeleteSql = "DELETE FROM directory WHERE Main_Directory = '{$dirId}'";
mysql_query($dirDeleteSql);
}
}