mysql - deleting file with unlink function php -


this script working deleting mysql database, it's not unlinking local directory files. can fix script? here's script

<?php     include "../config/database.php";     if(isset($_get['kode'])){  	$id = (int) $_get['kode'];  	$sql = "select * anidata id='$id'";  	$query = mysql_query($sql);  	if(mysql_num_rows($query) > 0 ){  		$data = mysql_fetch_array($query);  		//delete file  		$path = 'upload/'.$data['image'];  		@unlink($path);  		//delete database  		mysql_query("delete anidata id='$id'");  	}  }     header("location: view.php");   ?>

and helping anyway! :)

first try check if file deleted directory

  if( @unlink($path) ) {         mysql_query("delete `anidata` id='$id'");   } 

if not deleted database, check assigned path in php code !!


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -