Foros del Web » Programando para Internet » PHP »

unexpected $end in

Estas en el tema de unexpected $end in en el foro de PHP en Foros del Web. hola amigos podrian decirme por que me sale esto Parse error: syntax error, unexpected $end in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 204...
  #1 (permalink)  
Antiguo 29/05/2009, 12:17
Avatar de julita_punch  
Fecha de Ingreso: abril-2007
Ubicación: Lima - Peru
Mensajes: 505
Antigüedad: 16 años, 11 meses
Puntos: 4
unexpected $end in

hola amigos

podrian decirme por que me sale esto

Parse error: syntax error, unexpected $end in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 204
__________________
Julita Borda Hokama
a lo mejor esto ayuda
  #2 (permalink)  
Antiguo 29/05/2009, 12:19
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
Respuesta: unexpected $end in

podrias pegar todo el codigo ya que posiblemente no hayas cerrado un {
  #3 (permalink)  
Antiguo 29/05/2009, 12:21
Avatar de julita_punch  
Fecha de Ingreso: abril-2007
Ubicación: Lima - Peru
Mensajes: 505
Antigüedad: 16 años, 11 meses
Puntos: 4
Respuesta: unexpected $end in

Código php:
Ver original
  1. <?php
  2. $state = false;
  3. if ($_POST['action'] == "add") {
  4.     $conexion = mysql_connect("localhost", "mihueb_osmar", "ninguna");
  5.     mysql_select_db("mihueb_demo", $conexion);
  6.    
  7.     $que = "INSERT INTO guia (guiaderemision, puntodepartida, puntodellegada, fechadeiniciodetraslado, costominimo, nombredeldestinatario, direcciondeldestinatario, rucdeldestinatario, marcaynumerodeplaca, constanciadeinscripcion, licenciadeconducir, nombredetransportes, rucdetransportes, cantidad, descripcion) ";
  8.     $que.= "VALUES ('".$_POST['num']."','".$_POST['part']."', '".$_POST['llega']."', '".$_POST['fecha']."', '".$_POST['costo']."', '".$_POST['listap_1']."', '".$_POST['dire']."', '".$_POST['ruc']."', '".$_POST['placa']."', '".$_POST['consta']."', '".$_POST['licen']."', '".$_POST['trans']."', '".$_POST['ructrans']."', '".$_POST['canti']."', '".$_POST['des']."') ";
  9.     $res = mysql_query($que, $conexion) or die(mysql_error());
  10.     $state = true;
  11.    
  12.     if(isset($_POST['ok'])){
  13. echo "LOS DATOS QUE SE MOSTRARON SON !!!"; echo "<br>";
  14. echo $_POST['direccion']; echo "<br>";
  15. echo $_POST['ruc']; echo "<br>";
  16.  
  17. // echo '<pre>';
  18. // var_dump($_POST);
  19. // echo '</pre>';
  20. }
  21.  
  22. ?>
  23. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  27. <title>.:: GUIAS DE REMISION STEEL JRV ::.</title>
  28.  
  29. <script languaje="javascript">
  30.  
  31. function lista_cli(lista){
  32.  
  33. document.form.clientes.value = lista.options[lista.selectedIndex].getAttribute("alt1");
  34.  
  35. document.form.direccion.value = lista.options[lista.selectedIndex].getAttribute("alt2");
  36.  
  37. document.form.ruc.value = lista.options[lista.selectedIndex].getAttribute("alt3");
  38.  
  39. }
  40.  
  41. </script>
  42.  
  43.  
  44. <?php
  45.  
  46. $var="";
  47.  
  48. $resu=mysql_query("select * from clientes order by clientes",$conexion);
  49.  
  50. while ($row_cli=mysql_fetch_array($resu))
  51.  
  52. {
  53.  
  54. $var.= '<option value="'.$row_cli["codcli"].'" "'.$row_cli["clientes"].'",
  55.  
  56. alt1="'.$row_cli["codcli"].'",
  57.  
  58. alt2="'.$row_cli["direccion"].'",
  59.  
  60. alt3="'.$row_cli["ruc"].'">'.
  61.  
  62. $row_cli["clientes"].'</option>';
  63.  
  64. }
  65.  
  66. ?>
  67.  
  68. <style type="text/css">
  69. <!--
  70. body {
  71.     font-family: "Trebuchet MS", Tahoma, Arial;
  72.     font-size: 12px;
  73.     color: #333333;
  74.     background-image: url(guia.jpg);
  75.     background-color: #FFFFFF;
  76.     background-repeat: repeat;
  77. }
  78. h2 {
  79.     font-size: 16px;
  80.     color: #CC0000;
  81. }
  82. input, select {
  83.     font-family: "Trebuchet MS", Tahoma, Arial;
  84.     font-size: 11px;
  85.     color: #666666;
  86. }
  87. .Estilo34 {color: #FFFFFF}
  88. .Estilo45 {
  89.     color: #1A3B5C;
  90.     font-family: Arial, Helvetica, sans-serif;
  91. }
  92.  
  93. .campo {
  94.     border: 1px Solid #FFFFFF;
  95.     background: #FFFFFF;
  96. }
  97. .campo1 {border: 2px;
  98. background: 888888;
  99. }
  100.  
  101. -->
  102. </style>
  103. </head>
  104. <body>
  105. <form id="form" name="form" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
  106. <table width="724" border="0">
  107.   <tr>
  108.     <td height="803" align="left" valign="top" background="jrv-p3-1.jpg">
  109.     <form action="#" onsubmit="return validate_form();" method="post" id="enquiryform">
  110.       <br />
  111.       <br />
  112.       <br />
  113.       <br />
  114.       <br />
  115.       <br />
  116.       <form id="insertar" name="insertar" method="post" action=""><div align="center">
  117.         <table width="713" height="42" border="0">
  118.             <tr>
  119.               <td width="551"><br /></td>
  120.               <td width="152"><input name="num" type="text" id="num" class="campo" onclick="if(this.value=='Gu&iacute;a de Remisi&oacute;n N&ordm;')this.value='';" value="Gu&iacute;a de Remisi&oacute;n N&ordm;" size="30" /></td>
  121.             </tr>
  122.           </table>
  123.           <table width="658" height="30" border="0" align="center">
  124.             <tr>
  125.               <td width="68">&nbsp;</td>
  126.               <td width="255"><input name="part" type="text" id="part" class="campo" onclick="if(this.value=='Punto de Partida')this.value='';"  value="Punto de Partida" size="35" /></td>
  127.               <td width="7">&nbsp;</td>
  128.               <td width="79">&nbsp;</td>
  129.               <td width="227"><input name="llega" type="text" id="llega" class="campo" onclick="if(this.value=='Punto de Salida')this.value='';" value="Punto de Salida" size="45" /></td>
  130.             </tr>
  131.           </table>
  132.           <table width="665" border="0" align="left">
  133.             <tr>
  134.               <td width="237"><input name="licen" type="text" id="licen" class="campo" onclick="if(this.value=='Licencia de Conducir')this.value='';" value="Licencia de Conducir" size="30" /></td>
  135.               <td width="418"><select name="listap_1" class="campo1" onchange="lista_cli(this)">
  136.                 <option value="option" id="ruc" >Clientes</option>
  137.                 <?php echo $var?>
  138.               </select></td>
  139.             </tr>
  140.             <tr>
  141.               <td>&nbsp;</td>
  142.  
  143.               <td width="418"><input type="text" id="dire" class="campo1" size="60" name="dire" /></td>
  144.             </tr>
  145.             <tr>
  146.               <td width="237"><input name="costo" type="text" id="costo" class="campo" onclick="if(this.value=='Costo Minimo')this.value='';" value="Costo Minimo" size="30" /></td>
  147.               <td width="418"><input type="text" id="ruc" class="campo1" size="20" name="ruc" /></td>
  148.             </tr>
  149.           </table>
  150.           <br />
  151.           <br />
  152.           <br />
  153.           <br />
  154.           <br />
  155.           <br />
  156. <table width="665" border="0" align="left">
  157.             <tr>
  158.               <td width="219"><input name="placa" type="text" id="placa" class="campo" onclick="if(this.value=='Placa')this.value='';" value="Placa" size="30" /></td>
  159.               <td width="436"><input name="trans" type="text" id="trans" class="campo" onclick="if(this.value=='Nombre de Transportes')this.value='';" value="Nombre de Transportes" size="30" /></td>
  160.             </tr>
  161.             <tr>
  162.             <td width="219"><input name="consta" type="text" id="consta" class="campo" onclick="if(this.value=='Constancia de Inscripcion')this.value='';" value="Constancia de Inscripcion" size="30" />
  163.             <td width="436"><input name="dire" type="text" id="dire" class="campo" onclick="if(this.value=='Direccion')this.value='';" value="Direccion" size="30" /></td>
  164.             </tr>
  165.             <tr>
  166.               <td width="219"><input name="nombredest" type="text" id="nombredest" class="campo" onclick="if(this.value=='Licencia de Conducir')this.value='';" value="Licencia de Conducir" size="30" /></td>
  167.               <td width="436"><input name="ructrans" type="text" id="ructrans" class="campo" onclick="if(this.value=='RUC')this.value='';" value="RUC" size="30" /></td>
  168.             </tr>
  169.           </table>
  170.           <br />
  171.           <br />
  172.           <span class="Estilo34">..........................</span><br />
  173.           <br />
  174.           <br />
  175.           <br />
  176.           <table width="665" border="0" align="left">
  177.             <tr>
  178.               <td width="215"><input name="canti" type="text" id="canti" class="campo" onclick="if(this.value=='Cantidad')this.value='';" value="Cantidad" size="30" /></td>
  179.               <td width="215"><input name="des" type="text" id="des" class="campo" onclick="if(this.value=='Descripcion')this.value='';" value="Descripcion" size="30" /></td>
  180.               <td width="163"><input name="nombredest" type="text" id="nombredest" class="campo" onclick="if(this.value=='Precio Unitario')this.value='';" value="Precio Unitario" size="30" /></td>
  181.               <td width="219"><input name="nombredest" type="text" id="nombredest" class="campo" onclick="if(this.value=='Total')this.value='';" value="Total" size="30" /></td>
  182.             </tr>
  183.           </table>
  184.           <br />
  185.           <br />
  186.           <br />
  187.           <br />
  188.           <br />
  189.           <br />
  190.           <br />
  191.           <br />
  192.           <input type="submit" name="Submit" value="Insertar Registro" />
  193.         </div>
  194.       </form>
  195.     </td>
  196.   </tr>
  197. </table>
  198. <img name="" src="" width="32" height="32" alt="" />
  199. <h2>&nbsp;</h2>
  200.  
  201. <p align="center"><em>Registro insertado correctamente</em></p>
  202.  
  203. </body>
  204. </html>
__________________
Julita Borda Hokama
a lo mejor esto ayuda

Última edición por jam1138; 29/05/2009 a las 13:38 Razón: Utilizo un simple botón para colorear código
  #4 (permalink)  
Antiguo 29/05/2009, 12:23
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
Dame un break ya que no veo los colores. Trata de usar los [ PHP ] codigo va aqui [ /PHP ] lo escribes sin los espacios que hay entre el [ y php y ]

ya lo encontre el problema esta en el primer if

if ($_POST['action'] == "add") {

no lo cerraste busca donde tu querias cerrarlo
me dejas saber

Última edición por jam1138; 29/05/2009 a las 13:33
  #5 (permalink)  
Antiguo 29/05/2009, 12:24
Avatar de julita_punch  
Fecha de Ingreso: abril-2007
Ubicación: Lima - Peru
Mensajes: 505
Antigüedad: 16 años, 11 meses
Puntos: 4
Respuesta: unexpected $end in

no entender...
__________________
Julita Borda Hokama
a lo mejor esto ayuda
  #6 (permalink)  
Antiguo 29/05/2009, 12:26
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
Respuesta: unexpected $end in

el primer if tiene abierto el { pero no tiene el } escoge la linea de codigo que tu quieres que se cierre el }

se supone que sea

if ($_POST['action'] == "add") {

//linea de codigo

} <------------------------------ te falta este
  #7 (permalink)  
Antiguo 29/05/2009, 12:40
Avatar de julita_punch  
Fecha de Ingreso: abril-2007
Ubicación: Lima - Peru
Mensajes: 505
Antigüedad: 16 años, 11 meses
Puntos: 4
Respuesta: unexpected $end in

ora me sale esto


Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 49

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 51
__________________
Julita Borda Hokama
a lo mejor esto ayuda
  #8 (permalink)  
Antiguo 29/05/2009, 13:09
Avatar de abimaelrc
Colaborador
 
Fecha de Ingreso: mayo-2009
Ubicación: En el planeta de Puerto Rico
Mensajes: 14.734
Antigüedad: 14 años, 10 meses
Puntos: 1517
Respuesta: unexpected $end in

Escribe el que corregiste ahora para saber pero trata de que el codigo que escribas lo escribas entre medio de

[ PHP] aqui escribes el codigo [/PHP]
  #9 (permalink)  
Antiguo 29/05/2009, 13:36
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 7 meses
Puntos: 102
Respuesta: unexpected $end in

Cita:
Iniciado por julita_punch Ver Mensaje
ora me sale esto


Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 49

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mihueb/public_html/steeljrv.com/comprobantes-de-pago/guia-de-remision.php on line 51
Lee los errores. El argumento pasado a mysql_query() no es una conexión válida de MySQL.

Simple: revisa tu conexión. Igual puedes utilizar mysql_query() pasando solo la query a ejecutar y tomará la última conexión abierta, esto para que no tengas errores con nombres de variables (si solo ocuparás una conexión), aunque tu problema estará en la elección de la base de datos y/o en la conexión a MySQL.

Y, por favor, hay un botón para colorear código: ayuda a que se te ayude.

Un saludo
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:33.