adam291086 Posted October 5, 2007 Share Posted October 5, 2007 Why wont the files delete. It always say error deleting photo and i dont know why <html> <header> <META HTTP-EQUIV="refresh" CONTENT=5";URL=www.adamplowman.co.uk/index.html"> </header> <body> <?php include("config.php"); // No album id has been selected if( !$_GET['album_id'] ){ $msg .= "Album not selected. Please choose an album you wish to delete!"; $msg .= "<br /><a href=\"edit_album.php\">Edit albums</a>"; displayPage($msg, "Error Selecting Album"); } else { $con; // Retrieve image and thumbnail path information $sql = "SELECT photo_location, thumbnail_location FROM photos WHERE album_id = " . addslashes($_GET['album_id']); $result = mysql_query($sql) or die("Error retrieving records: " . mysql_error()); while ($row = mysql_fetch_array($result));{ $photo_location = $row['photo_location']; $thumb_location = $row['thumbnail_location']; if (@unlink("../adam/photos/" . $photo_location)){ } else { die("Error deleting photo!<br /><a href=\"index.html\">Please try again</a>."); } if (@unlink("../adam/thumbs/" . $thumb_location)){ } else { die("Error deleting thumbnail!<br /><a href=\"index.html\">Please try again</a>."); } // Delete specified album $sql = "DELETE FROM albums WHERE album_id = " . addslashes($_GET['album_id']); $result = @mysql_query($sql) or die("Error deleting record: " . mysql_error()); // Delete specified photo $sql = "DELETE FROM photos WHERE album_id = " . addslashes($_GET['album_id']); $result = @mysql_query($sql) or die("Error deleting record: " . mysql_error()); // Display success to user $msg .= "Photos and album have been successfully deleted The page will now Refresh!<br />"; displayPage($msg, "Album and Photos Deleted!"); } } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/ Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 don't use @ in front of function calls. this hides errors that you might see otherwise. try unlink without @ Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362510 Share on other sites More sharing options...
adam291086 Posted October 5, 2007 Author Share Posted October 5, 2007 i have removec them all but still having the same problem Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362521 Share on other sites More sharing options...
emehrkay Posted October 5, 2007 Share Posted October 5, 2007 you may need a full server path instead of a relative path '../whatever/you/did' Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362527 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 okay, no errors? you don't have errors turned off, correct? i assume the file exists. try using absolute path instead of relative path. change ../adam/whatever to the full path: /usrs/web/adam/whatever or if adam is a directory in www, you can use $_SERVER['DOCUMENT_ROOT']."/adam/whatever/.." previous poster beat me to it. Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362529 Share on other sites More sharing options...
adam291086 Posted October 5, 2007 Author Share Posted October 5, 2007 Dont need a full servere path as i have another page that deletes single photos and it works fine. Its just this page. The file does exist yes. As a created one specially Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362539 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 Dont need a full servere path as i have another page that deletes single photos and it works fine. that doesn't preclude the need to use full path on this page... Quote Link to comment https://forums.phpfreaks.com/topic/71970-php-drives-me-mad/#findComment-362545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.