Problema com Concatenação
Boa Noite Galera...
estou com um problema de concatenação, criei um while e tudo certo, mas quando tento concatenar a chave para fechar o while ele dá um erro
Parse error: syntax error, unexpected '}' in /home/ibatista/public_html/shop/sis/newsletter/formail.php on line 151
<?
session_start("admin");
$_SESSION["n"] = $n;
$_SESSION["remetente"] = $remetente;
$_SESSION["assunto"] = $assunto;
$_SESSION["imagem"] = $imagem;
$_SESSION["r_produto"] = $r_produto;
if($_SESSION["admin"] == "on")
{
require('../../admin/permissao.php');
$conexao=@mysql_connect($servidor,$usuario,$senha) or exit ('erro de conexao');
@mysql_select_db($base_dados,$conexao) or exit ('erro na conexão com o Banco');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Loja Virtual - IBR Shopping (Sistema Admin)</title>
<link href="[http://www.ibrbirigui.com.br/shop/sis/css/estilos.css"](http://www.ibrbirigui.com.br/shop/sis/css/estilos.css) rel="stylesheet" type="text/css"/>
<link href="[http://www.ibrbirigui.com.br/shop/sis/css/estilos.css"](http://www.ibrbirigui.com.br/shop/sis/css/estilos.css) rel="stylesheet" type="text/css"/>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="143" align="center" background="../../imagens/back.png">
<table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<img src="../imagens/topo_sis.jpg" alt="" width="900" height="200" border="0" /></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" height="233" border="0" cellpadding="1" cellspacing="1">
<tr>
<td height="30" align="center" valign="middle" bgcolor="#333333" class="topo">Envio de Newsletter</td>
</tr>
<tr>
<td height="148" align="center" valign="middle" class="texto_bottom"><label>
<?
// DADOS DE ACESSO AO BANCO MYSQL
require('config.php');
$n = $_SESSION["n"];
$remetente = $_SESSION["remetente"];
// NOME DA TABELA
$tabela = "newsletter";
// CAMPOS UTILIZADOS PARA A CONSULTA
$campos = "id, email";
// NUMERO MÁXIMO DE ENVIO
$quant = 1;
// TEMPO ENTRE UM PROCESSO DE ENVIO E OUTRO
$seg = 4;
$imagem = $_SESSION["imagem"];
$r_produto = $_SESSION["r_produto"];
$msg = '
<html>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="[http://www.ibrbirigui.com.br/shop/newsletter/imagens/news_topo.jpg"](http://www.ibrbirigui.com.br/shop/newsletter/imagens/news_topo.jpg) width="600" height="394" /></td>
</tr>
<tr>
<td height="302" valign="top">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left" valign="middle">'.
$id = $_SESSION["r_produto"];
$consulta = "SELECT * FROM produtos WHERE (id=$id)";
$retorno = mysql_query($consulta,$conexao);
$campos = mysql_fetch_assoc($retorno).'
</td>
</tr>
<tr>
<td width="158" align="left" valign="top">
<img src="[http://www.ibrbirigui.com.br/shop/sis/imagens/produtos/'.$campos['foto'].'"](http://www.ibrbirigui.com.br/shop/sis/imagens/produtos/) alt="'.$campos['nome'].'" width="150" border="0" align="middle" /></td>
<td width="430" align="left" valign="top">
<p>
<a class="texto_menu_negrito2">'.$campos['nome'].'</a><br />
<a class="texto_bottom">
<strong>Código do Produto:</strong></a> <a class="texto_bottom">'.$campos['cod_produto'].'</a><br />
<br />
<a class="texto_menu_negrito2"><strong>Valor à vista R$</strong>'.
$valor_vista = $campos['valor'];
$valor_dec = number_format($valor_vista, 2, ',', '.');
print $valor_dec.'
</a>'.
$valor_parcelado = $campos["valor_prazo"]/$campos['parcelas'];
$valor_parcelado_format = number_format($valor_parcelado, 2, ',', '.').'
</p>
<div align="justify">
<a class="texto_bottom">'.nl2br($campos['descricao']).'</a></div></td>
</tr>
</table><br /><br />'.
$consulta= "SELECT * FROM produtos ORDER BY rand() LIMIT 6";
$retorno = mysql_query($consulta,$conexao);
while($campos = mysql_fetch_assoc($retorno))
{
$valor_vista = $campos['valor'];
$valor_vista_formatado = number_format($valor_vista, 2, ',', '.');
$valor_prazo = $campos['valor_prazo'];
$valor_prazo_formatado = number_format($valor_prazo, 2, ',', '.');
$id = $campos['id'].'
<div style="float: left; ">
<table width="238" border="0" cellpadding="1" cellspacing="1" >
<tr>
<td width="234" height="105" align="center">
<img src="[http://www.ibrbirigui.com.br/sis/imagens/produtos/'.$campos['foto'].'"](http://www.ibrbirigui.com.br/sis/imagens/produtos/) alt="'.$campos['nome'].'" height="100" border="0" align="middle" /></td>
</tr>
<tr>
<td height="60" align="center" valign="top">
<a class="link_menu2">'.$campos['nome'].'</a><br />
<a class="topo_menor">Por: '.$valor_vista.'</a><br />'.
$categoria = $campos["categoria"];
$consulta_cat = "SELECT * FROM categoria WHERE id = '$categoria'";
$retorno_cat = mysql_query($consulta_cat,$conexao);
$campos_cat = mysql_fetch_assoc($retorno_cat).'
<a class="texto_menu"><b>Veja mais '.$campos_cat["nome"].'</b></a></td>
</tr>
</table>
</form>
</div>'.}.' //o erro está aqui
</td>
</tr>
<tr>
<td><img src="../imagens/news_rodape.jpg" width="600" height="198" /></td>
</tr>
</table>
<map name="Map" id="Map">
<area shape="rect" coords="4,4,96,98" href="[http://www.ibrbirigui.com.br/shop/detalhes.php?id='.$campos['id'].'"](http://www.ibrbirigui.com.br/shop/detalhes.php?id=) />
</map>
</html>
';
// DADOS DO EMAIL A SER ENVIADO
$assunto = $_SESSION["assunto"];
// CONECTA COM O SERVIDOR MYSQL
mysql_connect($host,$usuario,$senha);
// SELECIONA O BANCO
mysql_select_db($banco);
// RESGATA O VALOR DA GLOBAL INICIO
$inicio = $_GET["inicio"];
// VERIFICA SE FOI ATRIBUIDO VALOR A VARIAVEL "INICIO"
if($inicio == "")
{
// ATRIBUI O VALOR 0 CASO NÃO EXISTA VALOR ATRIBUIDO
$inicio = 0;
}
else
{
// ATRIBUI O VALOR DA GLOBAL INICIO CASO JA EXISTA VALOR ATRIBUIDO
$inicio = $_GET["inicio"];
}
// ATRIBUI O RESULTADO DA SOMA ENTRE INICIO E QUANT
$fim = $inicio + $quant;
// EXECUTA A CONSULTA OU INFORMA UM ERRO CASO OCORRA
$sql = mysql_query("SELECT ". $campos ." FROM ". $tabela ." WHERE enviado = 0 LIMIT ". $inicio .",". $quant)or die(mysql_error());
// VERIFICA SE AINDA EXISTEM EMAILS A SEREM ENVIADOS
if(mysql_num_rows($sql) == 0)
{
// INFORMO O TÉRMINO DO PROCESSO
echo "<span class='style1'>Fim do processo de envio!</span>";
$consulta= "SELECT * FROM newsletter ORDER BY id asc ";
$retorno = mysql_query($consulta,$conexao);
while($campos = mysql_fetch_assoc($retorno))
{
$id_ant = $campos['id'];
$consulta2 = "UPDATE newsletter SET enviado ='0' WHERE id='$id_ant'";
mysql_select_db($base_dados, $conexao);
$Result1 = mysql_query($consulta2, $conexao) or die(mysql_error());
print "".$campos['email']." realocado com sucesso ";
print "<br>";
}
}
else
{
// CONTINUA EFETUANDO O ENVIO
echo "<meta http-equiv='refresh' content='$seg,URL=?inicio= $fim'>";
}
// CRIA O LAÇO REPETITIVO
while($r = mysql_fetch_assoc($sql))
{
// ADICIONAMOS OS PADRÕES DE DESTINATÁRIO
$para = $r['email'];
$id = $r['id'];
$cabecalho = "MIME-Version: MSHTML 6.00.2900.3157\r\n";
$cabecalho = "Content-type: text/html; charset=iso-8859-1\r\n";
$cabecalho .= "Content-Type: text/html; charset=windows-1252\r\n";
$cabecalho .= "From:$remetente<$n>\r\n";
$cabecalho .= "Reply-to:<$remetente>\r\n";
// ENVIA O EMAIL PARA O DESTINATÁRIO
if(mail($para, $assunto, $msg, $cabecalho))
{
// INFORMA SE A MENSAGEM FOI ENVIADA
echo "<span class='style1'>Mensagem enviada para: $para ($id)</span>";
// ALTERO O CODSTATUS PARA 1
@mysql_query("UPDATE newsletter SET enviado = '1' WHERE email = '$para'");
}
else
{
// INFORMO SE A MENSAGEM NÃO FOI ENVIADA
echo "<span class='style1'>Mensagem não enviada para: $para ($id)</span>";
}
}
// LIBERA MEMORIA USADA NA CONSULTA
mysql_free_result($sql);
}
?></label></td>
</tr>
<tr>
<td height="51" align="center" valign="middle" class="texto_bottom"><img src="../../imagens/ferramentas_sis.png" width="20" height="20" /> <a href="../index.php" class="texto_bottom">Voltar para Sistema</a></td>
</tr>
</table>
</body>
</html>
O ERRO ESTÁ NA SEGUINTE LINHA: '.}.' //o erro está aqui
Discussão (12)
Carregando comentários...