nadman123 Posted September 24, 2008 Share Posted September 24, 2008 hey guys ..this is the code... <?php break; case "Delete": ?> <center> Confirm deletion of the following client record <br /></center><p /> <table align="center" cellpadding="3"> <tr /> <td><b>Property NO</b></td> <td><?php echo $row["PROPERTY_ID"]; ?></td> </tr> <tr> <td><b>Property Address</b></td> <td><?php echo $row["PROPERTY_STREET"]. " ".$row["PROPERTY_SUBURB"]; ?></td> </tr> </table> <br/> <table align="center"> <tr> <td> <a style="text-decoration:none" href="PropertyModify.php?Property_id=<?php echo $row["PROPERTY_ID"]; ?>&Action=ConfirmDelete"><input type=button value=Confirm></a> </td> <td> <input type="button" value="Cancel" OnClick="window.location='property.php'"> </td> </tr> </table> <?php break; case "ConfirmDelete": $query="DELETE FROM Property WHERE Property_id =".$_GET["Property_id"]; $stmt = oci_parse($conn,$query); unlink($row["PROPERTY_IMAGE"]); if(@oci_execute($stmt)) { ?> <center> The following client record has been successfully deleted<br /> <?php echo "Property No. ".$row["PROPERTY_ID"] ." ".$row["PROPERTY_STREET"]." ".$row["PROPERTY_SUBURB"]; echo "</center>"; } else { echo "<center> Error deleting property record</center><p />"; } echo "<center><input type='button' value='Return to List' OnClick='window.location=\"property.php\"'> <center>"; break; } oci_free_statement($stmt); oci_close($conn); ?> and i get an error message called Warning: unlink() [function.unlink]: Permission denied in e:\web\pro\PropertyModify.php on line 141 Link to comment https://forums.phpfreaks.com/topic/125563-delete-file-error/ Share on other sites More sharing options...
nadman123 Posted September 24, 2008 Author Share Posted September 24, 2008 actually the code is here.. <?php break; case "Delete": ?> <center> Confirm deletion of the following client record <br /></center><p /> <table align="center" cellpadding="3"> <tr /> <td><b>Property NO</b></td> <td><?php echo $row["PROPERTY_ID"]; ?></td> </tr> <tr> <td><b>Property Address</b></td> <td><?php echo $row["PROPERTY_STREET"]. " ".$row["PROPERTY_SUBURB"]; ?></td> </tr> </table> <br/> <table align="center"> <tr> <td> <a style="text-decoration:none" href="PropertyModify.php?Property_id=<?php echo $row["PROPERTY_ID"]; ?>&Action=ConfirmDelete"><input type=button value=Confirm></a> </td> <td> <input type="button" value="Cancel" OnClick="window.location='property.php'"> </td> </tr> </table> <?php break; case "ConfirmDelete": $query="DELETE FROM Property WHERE Property_id =".$_GET["Property_id"]; $stmt = oci_parse($conn,$query); unlink($row["PROPERTY_IMAGE"]); if(@oci_execute($stmt)) { ?> <center> The following client record has been successfully deleted<br /> <?php echo "Property No. ".$row["PROPERTY_ID"] ." ".$row["PROPERTY_STREET"]." ".$row["PROPERTY_SUBURB"]; echo "</center>"; } else { echo "<center> Error deleting property record</center><p />"; } echo "<center><input type='button' value='Return to List' OnClick='window.location=\"property.php\"'> <center>"; break; } oci_free_statement($stmt); oci_close($conn); ?> Link to comment https://forums.phpfreaks.com/topic/125563-delete-file-error/#findComment-649204 Share on other sites More sharing options...
ranjuvs Posted September 24, 2008 Share Posted September 24, 2008 Print out and see what is the valu for $row["PROPERTY_IMAGE"] and check whether its a valid path and file. Also see whether the file has the required permissions Link to comment https://forums.phpfreaks.com/topic/125563-delete-file-error/#findComment-649317 Share on other sites More sharing options...
dropfaith Posted September 24, 2008 Share Posted September 24, 2008 if the error states permission denied then you should only need to fis the permissions on the files Link to comment https://forums.phpfreaks.com/topic/125563-delete-file-error/#findComment-649324 Share on other sites More sharing options...
vikramjeet.singla Posted September 24, 2008 Share Posted September 24, 2008 i am agree from "ranjuvs"... moreover please check whether file exists before deleting... try this if(is_file($row["PROPERTY_IMAGE"]) && file_exists($row["PROPERTY_IMAGE"])){ // delete file } Link to comment https://forums.phpfreaks.com/topic/125563-delete-file-error/#findComment-649359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.