Forums

PHP

This topic is locked

php/mysql edit

Posted 23 Sep 2003 13:04:27
1
has voted
23 Sep 2003 13:04:27 Finn Connell posted:
Hi
In following the php/mysql tutorial by Allan Kent all works fine until I try to edit. THis error was received:
Warning: Cannot modify header information - headers already sent by (output started at /Users/finnconn/Sites/dmxzone/edit.php:5) in /Users/finnconn/Sites/dmxzone/edit.php on line 44

(from)Line 44 reads:
mysql_select_db($database_dmxzone, $dmxzone);
$Result1 = mysql_query($updateSQL, $dmxzone) or die(mysql_error());

$updateGoTo = "countries.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

The change is recorded in the database.

Any help would be gratefully received. Thank you.

Replies

Replied 27 Sep 2003 03:12:15
27 Sep 2003 03:12:15 Phil Shevlin replied:
This means your code has already started sending data to the client browser. Did you edit something above the code you pasted here OR did you just add the...

header(sprintf("Location: %s", $updateGoTo));

... part?
Replied 04 Oct 2003 06:08:21
04 Oct 2003 06:08:21 Tim Olson replied:
Try checking to see if you have

mysql_free_result($table);

repeated at the bottom of the page. If it is there for the same recordset twice delete one and try it again.

It seems to happen to me when I reuse the same page and don't delete the old recordset completely.

Reply to this topic