
11/04/2007, 13:51
|
 | | | Fecha de Ingreso: junio-2002 Ubicación: España
Mensajes: 73
Antigüedad: 22 años, 9 meses Puntos: 0 | |
Re: Cannot modify header information Pues no, debo decir que el código lo inserta automáticamente Dreamweaver
esto es lo que tengo:
Código:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "inserta_noticias")) {
$updateSQL = sprintf("UPDATE noticias SET fecha=%s, fuente=%s, titulo=%s, noticia=%s WHERE noticiaID=%s",
GetSQLValueString($_POST['fecha'], "date"),
GetSQLValueString($_POST['fuente'], "text"),
GetSQLValueString($_POST['titular'], "text"),
GetSQLValueString($_POST['noticia'], "text"),
GetSQLValueString($_POST['noticiaID'], "text"));
mysql_select_db($database_ecom_noticias, $ecom_noticias);
$Result1 = mysql_query($updateSQL, $ecom_noticias) or die(mysql_error());
$updateGoTo = "www.dominio.com/administrar/confirma-cambios-noticias.html";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_edita_noticia = "-1";
if (isset($_GET['noticiaID'])) {
$colname_edita_noticia = (get_magic_quotes_gpc()) ? $_GET['noticiaID'] : addslashes($_GET['noticiaID']);
}
mysql_select_db($database_ecom_noticias, $ecom_noticias);
$query_edita_noticia = sprintf("SELECT * FROM noticias WHERE noticiaID = %s", $colname_edita_noticia);
$edita_noticia = mysql_query($query_edita_noticia, $ecom_noticias) or die(mysql_error());
$row_edita_noticia = mysql_fetch_assoc($edita_noticia);
$totalRows_edita_noticia = mysql_num_rows($edita_noticia);
?>
|