Jump to content

Delete image error


emediastudios

Recommended Posts

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";
}?>

Link to comment
Share on other sites

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";
}?>

Link to comment
Share on other sites

  • 2 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.