Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3492760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:47:54+00:00 2026-05-18T11:47:54+00:00

<?php require ‘header.php’; require ‘connection.php’; mysql_query(DELETE FROM quotes WHERE ID = $_GET[id]) or die(didnt

  • 0
<?php
require 'header.php';
require 'connection.php';

mysql_query("DELETE FROM quotes WHERE ID = $_GET[id]") or die("didnt delete properly");
header('Location: index.php');
?>

When I run this it says:
Warning: Cannot modify header information – headers already sent by (output started at xxxxx on line 6

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:47:54+00:00Added an answer on May 18, 2026 at 11:47 am

    Either header.php or connection.php are outputting some content. You cannot modify the HTTP headers after content is sent, because the headers have already been sent at that point.

    A hack of a solution would be this:

    <?php
    
    ob_start();
    
    require 'header.php';
    require 'connection.php';
    
    mysql_query("DELETE FROM quotes WHERE ID = $_GET[id]") or die("didnt delete properly");
    
    header('Location: index.php');
    
    ob_end_flush();
    
    ?>
    

    However, you should instead figure out where content is being sent and suppress it, or reorder it to come after the header() call.

    If, as I suspect, header.php outputs an HTML header, you can just eliminate the require 'header.php'; line — the content will never be shown anyway, since this is a redirect.

    Also, note that the HTTP standard requires that the value of a Location header be an absolute URL. Therefore, header('Location: index.php'); will generate an HTTP response that is invalid according to the HTTP standard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP, as we all know is very loosely typed. The language does not require
Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider
php : view.php <h1>hello world</h1> php: index.php require('view.php'); if both files are on root
I have followed the Facebook PHP SDK example and created the following. <?php require
The error occurs on line 65: } catch (Exception $e){ <?php require includes/connect.php; function
I am trying to use Twitter Oauth to login. index.php <?php require (twitteroauth/twitteroauth.php); session_start();
In order to generate a XML i am using following Code currently. .<?php require
I have a php script that I'm trying to pull some data from a
Everything I read about better PHP coding practices keeps saying don't use require_once because
Specifically I have a PHP command-line script that at a certain point requires input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.