Hello
This is my code ,
i want to delete databse row and image from folder
it delete only database row,but it not delete image from folder...Why?
Please Help me
<?php
include('config.php');
$id=$_REQUEST['id'];
$image=$_REQUEST['image'];
$target_path='upload/';
if(isset($_REQUEST['action'])=='delete')
{
$query="delete from tbl_user where id='$id'";
$r1=mysql_query($query) or die(mysql_error());
unlink($target_path.$image);
header('Location:welcome.php');
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,687
Thanks: 42
Thanked 637 Times in 625 Posts
You can also check the return value from unlink() to see if it's true or false. You should probably comment out your header() call while you're trying to get this working because there may be an error message you're missing due to the immediate redirect.