Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Erilton

Erro no Update Record

Recommended Posts

Pessoal, já não sei mais o que fazer, utilizo a função update record do DWMX2004, consigo editar o registro, só que quando confirmo no botão alterar ao invés de ser direcionado para minha página (atualizado.php) apresenta a seguinte mensagem de erro:

 

 

Warning: Cannot modify header information - headers already sent by (output started at /xxxx) in xxxx.php on line 49

 

xxxx = minhas informações

 

Essa linha 49 é a responsável pelo redirect para (atualizado.php)

 

essa é a instrução da linha 49 = header(sprintf("Location: %s", $updateGoTo));

 

 

Espero que possam me ajudar

 

Abaixo todo o meu 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"] == "form1")) {

$updateSQL = sprintf("UPDATE lpublicidade SET titulo=%s, descricao1=%s, descricao2=%s, url=%s WHERE codigo=%s",

GetSQLValueString($_POST['titulo'], "text"),

GetSQLValueString($_POST['descricao1'], "text"),

GetSQLValueString($_POST['descricao2'], "text"),

GetSQLValueString($_POST['url'], "text"),

GetSQLValueString($_POST['codigo'], "int"));

 

mysql_select_db($database_bd_lpublicidade, $bd_lpublicidade);

$Result1 = mysql_query($updateSQL, $bd_lpublicidade) or die(mysql_error());

 

$updateGoTo = "atualizado.php";

if (isset($_SERVER['QUERY_STRING'])) {

$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";

$updateGoTo .= $_SERVER['QUERY_STRING'];

}

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

}

 

$colname_RsAtualiza = "-1";

if (isset($_GET['publicidade'])) {

$colname_RsAtualiza = (get_magic_quotes_gpc()) ? $_GET['publicidade'] : addslashes($_GET['publicidade']);

}

mysql_select_db($database_bd_lpublicidade, $bd_lpublicidade);

$query_RsAtualiza = sprintf("SELECT * FROM lpublicidade WHERE codigo = %s", $colname_RsAtualiza);

$RsAtualiza = mysql_query($query_RsAtualiza, $bd_lpublicidade) or die(mysql_error());

$row_RsAtualiza = mysql_fetch_assoc($RsAtualiza);

$totalRows_RsAtualiza = mysql_num_rows($RsAtualiza);

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

coloca essa linha antes de qualquer coisa na sua página:

 

<? ob_start(); ?>

 

e nessa no final após tudo

 

<? ob_end_flush(); ?>

 

eu acho que esse erro na configurarção do PHP!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.