This is my code for deleting an entry in my address book database
<?
include("config.php");
// open a connection to the database
$connection = mysql_connect($server, $user, $pass);
// formulate the SQL query - same as above
$query = "DELETE FROM addressbook WHERE id='$id'";
// run the query on the database
$result = mysql_db_query($db,$query ,$connection);
// close connection
mysql_close($connection);
header("Location: address.php?currYear=" . $currYear . "&currMonth=" . $currMonth . "&currDay=" . $currDay);
?>
config.php contains just the server name, user and password info.
I need to use the dates to enter data in my appoinment database.
This is the error that i get:-
Warning: Cannot add header information - headers already sent by (output started at /usr/local/nusphere/apache/nsdocs/deleteadd.php:2) in
/usr/local/nusphere/apache/nsdocs/deleteadd.php on line 18
What does that mean?
The exact same code works to delete entries from my appoinment table. The only difference is the table name and the header location file.😕
another thing that I would like to know is how do i tell the script to automatically delete specific entries in the database after a certain time. Example; 5 days after the appoinment, delete the database entry.