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
https://forums.phpfreaks.com/topic/96387-delete-image-error/
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
https://forums.phpfreaks.com/topic/96387-delete-image-error/#findComment-493340
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.