Claudio Vilarinho Postado Agosto 29, 2007 Denunciar Share Postado Agosto 29, 2007 Amigos,Estou fazendo uma condição e esta dando esse erro:Parse error: syntax error, unexpected T_ELSE in C:\site\paratudo\admin\ent_produtos_combosajax.php on line 41O código é esse:<?php ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ESCOLHA DO MOVIMENTO if ($_GET["acao"]=="SEARCHMOVIMENTO") { if ($_GET["movimento"]=="E"); { ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_entrada" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php else ($_GET["movimento"]=="S"); ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_saida" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php } } ?>O que poode estar errado?Obrigado Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 ESerra Postado Agosto 29, 2007 Denunciar Share Postado Agosto 29, 2007 else não tem atributo...ou seja, isso não existe...else ($_GET["movimento"]==S");é apenas:elseE outra coisa, isso:if ($_GET["movimento]=="E");{também tá errado, não tem ; ali, é apenas,if ($_GET["movimento"]=="E"){ Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Claudio Vilarinho Postado Agosto 29, 2007 Autor Denunciar Share Postado Agosto 29, 2007 Obrigado ESerra, mas fiz as alterações e continua com o erro.<?php ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ESCOLHA DO MOVIMENTO if ($_GET["acao"]=="SEARCHMOVIMENTO") { if ($_GET["movimento"]=="E") { ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_entrada" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php else ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_saida" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php } } ?> Esse é o código completo. <?php $gmtDate = gmdate("D, d M Y H:i:s"); header("Expires: {$gmtDate} UTC/GMT"); header("Last-Modified: {$gmtDate} UTC/GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-Type: text/html; charset=ISO-8859-1",true); ?> <?php ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //PRODUTO if ($_GET["acao"]=="SEARCHPRODUTO") { include("../conexao/config.php"); $SQL = "SELECT prod_descricao FROM tb_produtos WHERE prod_id_siga='".$_GET["produto"]."' ORDER BY prod_id_siga"; $RES = @mysql_query($SQL) or die("ERRO AO SELECIONAR ID SIGA - ".@mysql_error()); $col = @mysql_fetch_array($RES); ?> <td width="83%" height="20" align="left"> <input name="est_desc_produto" readonly="true" style="background:#cococo; border:0" value="<?php echo $col["prod_descricao"];?>" type="text" class="texto" size="50" maxlength="50"></td> <?php } @mysql_close($conn); ?> <?php ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //ESCOLHA DO MOVIMENTO if ($_GET["acao"]=="SEARCHMOVIMENTO") { if ($_GET["movimento"]=="E") { ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_entrada" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php else ?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_saida" type="text" class="texto" size="10" maxlength="10"></td> </tr> <?php } } ?>A parte //PRODUTO esta funcionando. Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 MLeandroJr! Postado Agosto 29, 2007 Denunciar Share Postado Agosto 29, 2007 O erro aqui continua no else.<?php else ?> O funcionamento dele parece com o do if, portanto, o else precisa ser aberto e fechado! Tente: <?php else { ?> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Claudio Vilarinho Postado Agosto 29, 2007 Autor Denunciar Share Postado Agosto 29, 2007 Pessoal, me desculpe, mas continua com erro, vou colocar a função ao qual esta chamando.Essa é a função:<script language="JavaScript"><!--function selecionaMovimento(movimento){ ajaxMOD = ajaxInit(); if(ajaxMOD) { ajaxMOD.open("GET", "ent_produtos_combosajax.php?movimento="+movimento+"&acao=SEARCHMOVIMENTO", true); ajaxMOD.onreadystatechange = function() { if(ajaxMOD.readyState == 1) { divMovimento.innerHTML = "<img src='images/aguarde.gif' width='15' height='15' align='left' alt='logando'> Gerando..."; } if(ajaxMOD.readyState == 4) { if(ajaxMOD.status == 200) { divMovimento.innerHTML = ajaxMOD.responseText; } else { alert(ajaxMOD.statusText); } } } ajaxMOD.send(null); }}--></script>////////////////////////////////////////////////Utiliza aqui: <tr valign="middle"> <td height="20" align="right">Movimento:</td> <td height="20" align="left"> <select name="est_transacao" class="selecao" onChange="selecionaMovimento(this.value);"> <option value="">Selecione</option> <option value="E" <?php if($col["est_transacao"]==E"){echo "selected";} ?>>Entrada</option> <option value="S" <?php if($col["est_transacao]=="S"){echo "selected";} ?>>Saida</option> </select> </td> </tr> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"><div id="divMovimento"></div></td> </tr>//////////////////////////////////////Que chama daqui;<?php$gmtDate = gmdate("D, d M Y H:i:s");header("Expires: {$gmtDate} UTC/GMT");header("Last-Modified: {$gmtDate} UTC/GMT");header("Cache-Control: no-cache, must-revalidate");header("Pragma: no-cache");header("Content-Type: text/html; charset=ISO-8859-1",true);?><?php////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PRODUTOif ($_GET["acao"]==SEARCHPRODUTO"){ include("../conexao/config.php"); $SQL = "SELECT prod_descricao FROM tb_produtos WHERE prod_id_siga='".$_GET["produto]."' ORDER BY prod_id_siga"; $RES = @mysql_query($SQL) or die("ERRO AO SELECIONAR ID SIGA - ".@mysql_error()); $col = @mysql_fetch_array($RES);?> <td width="83%" height="20" align="left"> <input name="est_desc_produto" readonly="true" style="background:#cococo; border:0" value="<?php echo $col["prod_descricao"];?>" type=text" class="texto" size="50" maxlength="50"></td><?php } @mysql_close($conn);?><?php////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ESCOLHA DO MOVIMENTOif ($_GET["acao]=="SEARCHMOVIMENTO"){ if ($_GET["movimento"]=="E") {?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_entrada" type="text" class="texto" size="10" maxlength="10"></td> </tr><?php else {?> <tr valign="middle"> <td width="17%" height="20" align="right"><span class="style7">Quantidade:</span></td> <td width="83%" height="20" align="left"> <input name="est_qtde_saida" type="text" class="texto" size="10" maxlength="10"></td> </tr><?php } }}?>Obrigado.Amigos,Consegui, esta funcionado, obrigado a todos. Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Claudio Vilarinho
Amigos,
Estou fazendo uma condição e esta dando esse erro:
Parse error: syntax error, unexpected T_ELSE in C:\site\paratudo\admin\ent_produtos_combosajax.php on line 41
O código é esse:
O que poode estar errado?
Obrigado
Link para o comentário
Compartilhar em outros sites
4 respostass 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.