Jump to content

Delete record Error


HalRau

Recommended Posts

First of all thank you for writing this script and putting it on the Internet. I have modified the Add, Edit and Delete script to my database. Everything works fine except the delete page.

Here is the code I have on that page:

<?php
/* 
DELETE.PHP
Deletes a specific entry from the 'directemail' table
*/

// connect to the database
include('connect-db.php');

// check if the 'id' variable is set in URL, and check that it is valid
if (isset($_GET['Rec_ID']) && is_numeric($_GET['Rec_ID']))
{
// get id value
$Rec_ID = $_GET['Rec_ID'];

// delete the entry
$result = mysql_query("DELETE FROM directemail WHERE Rec_ID=$Rec_ID")
or die(mysql_error()); 

// redirect back to the view page
header("Location: CNTCAdmin.php");
}
else
// if id isn't set, or isn't valid, redirect back to view page
{
header("Location: CNTCAdmin.php");
}

?>

The error message reads: "Warning: Cannot modify header information - headers already sent by (output started at /home/heartl20/public_html/admin/CNTCAdmin-delete.php:2) in /home/heartl20/public_html/admin/CNTCAdmin-delete.php on line 22"

NOTE: It does delete the record. It just doesn't go back to the CNTCAdmin.php page which is my "View" page.

 

Any help would be most appreciated.

Thanks, Hal

Link to comment
Share on other sites

Thank you. There was some white space, (line breaks) at the end, before the ?> end. None at the beginning but I had added some security code at the top of the page and that may have eliminated it.

 

Thanks again for your help and a great set of scripts.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...