Ir para conteúdo
Fórum Script Brasil
  • 0

Erro No Update Record


Erilton

Pergunta

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);

?>

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...