emediastudios Posted March 16, 2008 Share Posted March 16, 2008 Can someone see an error here. I dont get one on screen but it doesnt work. <?php if($secret == "56"){ $r = mysql_fetch_array(mysql_query("SELECT * FROM gallery WHERE ID='".$_GET[id]."'")); unlink($r[photo]); mysql_query("DELETE FROM gallery WHERE ID='".$_GET[id]."'"); echo "<script>window.location = 'admin.php?p=admin_gallery';</script>"; } else{ $content .= "You Must Be Logged In To Do That"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/96387-delete-image-error/ Share on other sites More sharing options...
wildteen88 Posted March 16, 2008 Share Posted March 16, 2008 Turn error reporting on if you can, by adding the following two lines to the top of your script ini_set('display_errors', 'On'); error_reporting(E_ALL); If that does work, add some debugging lines into your script: <?php ini_set('display_errors', 'On'); error_reporting(E_ALL); if($secret == "56") { echo 'Quering database...<br />'; $r = mysql_fetch_array(mysql_query("SELECT * FROM gallery WHERE ID='".$_GET[id]."'")); echo '<pre>$r equals ' . print_r($r, true) . '</pre>'; echo 'Deleting ' . $r[photo] . '... '; unlink($r[photo]) or die('FAILED'); echo ' SUCCESSFUL<br>'; echo 'Deleting from Database...'; mysql_query("DELETE FROM gallery WHERE ID='".$_GET[id]."'") or die('FAILDED. ' . mysql_error()); echo 'SUCCESSFULL';. //echo "<script>window.location = 'admin.php?p=admin_gallery';</script>"; } else { $content .= "You Must Be Logged In To Do That"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/96387-delete-image-error/#findComment-493340 Share on other sites More sharing options...
hschonen Posted June 12, 2008 Share Posted June 12, 2008 try @unlink instead of unlink did it for me Quote Link to comment https://forums.phpfreaks.com/topic/96387-delete-image-error/#findComment-563789 Share on other sites More sharing options...
jesushax Posted June 12, 2008 Share Posted June 12, 2008 shouldnt it be where ID='".$_GET["id"]."'" with speecch marks arounf the id in the get? Quote Link to comment https://forums.phpfreaks.com/topic/96387-delete-image-error/#findComment-563795 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.