tags:

views:

55

answers:

2

my code-

if ($result) 
{
    $row = $result->fetch_object();
    $filename = $row->src;

    $q = "delete from photos WHERE id=$fileid";
    $result = $mysqli->query($q) or die(mysqli_error($mysqli));
    if ($result) 
    {
        $filepath = "./images/";
        if(fileDelete($filepath,$filename))
        {
            echo "success";
            header("Location: index.php");
            exit;
        }
        else echo "failed";
    }
}

Output-
success
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\pics\deletepic.php:31) in C:\xampp\htdocs\pics\deletepic.php on line 32

+5  A: 

Can't echo ANYTHING before sending headers.

Mchl
+1  A: 

remove echo "success";

nectar