Foros del Web » Programando para Internet » PHP »

Ayuda con Parse Error

Estas en el tema de Ayuda con Parse Error en el foro de PHP en Foros del Web. Tengo el siguiente codigo que me da este error: Cita: Parse error: parse error, unexpected $ in D:\JmN\www\test\cd\index.php on line 133 la linea 133 es ...
  #1 (permalink)  
Antiguo 26/05/2003, 17:43
Avatar de jmn2k1  
Fecha de Ingreso: noviembre-2001
Ubicación: Buenos Aires...
Mensajes: 489
Antigüedad: 22 años, 5 meses
Puntos: 2
Pregunta Ayuda con Parse Error

Tengo el siguiente codigo que me da este error:

Cita:
Parse error: parse error, unexpected $ in D:\JmN\www\test\cd\index.php on line 133
la linea 133 es siempre una mas despues de la ultima...
este error siempre me pasa cuando tengo mal un { en un if pero lo revise y esta bien.
otra cosa, estoy usando eso de salidas con multiples lineas con

echo <<< HTML

HTML;

aca esta el codigo lo reviso pero no puedo encontrar el error:

Código PHP:
<html>
<head>
    <title>Cds y Videos - Cargar datos</title>
</head>
<body>
<?php
require ('conectar.con');
if (!isset(
$cargar)){
echo <<< HTML
    <center>
    <form method="get" action="$PHP_SELF">
    <input name="cargar" type="hidden" value="si">
    <table>
    <tr>
           <td>Nro. Inventario</td>
           <td><input name="inventario" type="text" size="5" maxlength="5" value="">
           <font face="arial" color="#ff0000" size="2">(Ejemplo: cd032 o vd001)</font></td>
    </tr>
    <tr>
           <td>Titulo</td>
           <td><input name="titulo" type="text" value=""></td>
    </tr>
    <tr>
           <td>Sub-Titulo</td>
           <td><input name="subtitulo" type="text" value=""></td>
    </tr>
    <tr>
           <td>Duracion</td>
           <td><input name="duracion" type="text" value=""></td>
    </tr>
    <tr>
           <td>Año de edicion</td>
           <td><input name="edicion" type="text" value=""></td>
    </tr>
    <tr>
       <td>Materia</td>
       <td><input name="materia" type="text" value=""></td>
    </tr>
    </table>
    <input type="submit" value="Cargar datos">
    </form>
HTML;  
    //<<<
}else{
     unset($cargar);
     if(empty($inventario)){
           echo <<< HTML
           <center>
           Por favor Complete el formulario<br>
           <form method="get" action="$PHP_SELF">
           <input name="cargar" type="hidden" value="si">
           <table>
           <tr>
              <td>Nro. Inventario</td>
              <td><input name="inventario" type="text" size="5" maxlength="5" value="">
              <font face="arial" color="#ff0000" size="2">(Ejemplo: cd032 o vd001)</font></td>
           </tr>
           <tr>
              <td>Titulo</td>
              <td><input name="titulo" type="text" value=""></td>
           </tr>
           <tr>
              <td>Sub-Titulo</td>
              <td><input name="subtitulo" type="text" value=""></td>
           </tr>
           <tr>
              <td>Duracion</td>
              <td><input name="duracion" type="text" value=""></td>
           </tr>
           <tr>
              <td>Año de edicion</td>
              <td><input name="edicion" type="text" value=""></td>
           </tr>
           <tr>
              <td>Materia</td>
              <td><input name="materia" type="text" value=""></td>
           </tr>
           </table>
           <input type="submit" value="Cargar datos">
           </form>
           HTML;  
           //<<<
     }else{
           $inv = $inventario;
           $tit = $titulo;
           $sub = $subtitulo;
           $dur = $duracion;
           $edi = $edicion;
           $mat = $materia;
           $query = "INSERT INTO cd_vd VALUES ('$inv','$tit','$sub','$dur','$edi','$mat')";
           mysql_query($query);
           echo <<< HTML
           <center>
           <strong><font face="arial" size="3">Datos Agregados Exitosamente</font></strong>
           <form method="get" action="$PHP_SELF">
           <input name="cargar" type="hidden" value="si">
           <table>
           <tr>
            <td>Nro. Inventario</td>
           <td><input name="inventario" type="text" size="5" maxlength="5" value="">
           <font face="arial" color="#ff0000" size="2">(Ejemplo: cd032 o vd001)</font></td>
           </tr>
           <tr>
              <td>Titulo</td>
             <td><input name="titulo" type="text" value=""></td>
           </tr>
           <tr>
              <td>Sub-Titulo</td>
              <td><input name="subtitulo" type="text" value=""></td>
           </tr>
           <tr>
           <td>Duracion</td>
              <td><input name="duracion" type="text" value=""></td>
           </tr>
           <tr>
              <td>Año de edicion</td>
              <td><input name="edicion" type="text" value=""></td>
           </tr>
           <tr>
              <td>Materia</td>
              <td><input name="materia" type="text" value=""></td>
           </tr>
           </table>
           <input type="submit" value="Cargar datos">
           </form>
           HTML;   
           //<<<
     }           
}
?>
</body>
</html>
espero que me puedan ayudar........

JmN

Última edición por jmn2k1; 26/05/2003 a las 18:01
  #2 (permalink)  
Antiguo 26/05/2003, 18:45
 
Fecha de Ingreso: febrero-2003
Ubicación: Viña del Mar
Mensajes: 85
Antigüedad: 21 años, 2 meses
Puntos: 2
Quizas la respuesta este en......

http://www.php.net/manual/es/function.echo.php

Jerry at tl165 dot net
04-Jan-2003 04:25

Note: Do not use SPACE or TAB before the last EOM like this

echo <<< EOM
Something you want to echo out
and so on...
EOM;

it will cause a error like "Parse error: parse error in /var/www/html/test.php on line 17"
__________________
http://www.zypper.cl/blues.gif
(web-hosting)

  #3 (permalink)  
Antiguo 26/05/2003, 20:34
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Pues así es .. En la sintax "Here Doc" no se puede usar ni un espacio o tabulador al terminar el "cierre" de la instrucción echo <<< XXX ... Ha de estar en una línea nueva ..

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
  #4 (permalink)  
Antiguo 27/05/2003, 08:49
Avatar de jmn2k1  
Fecha de Ingreso: noviembre-2001
Ubicación: Buenos Aires...
Mensajes: 489
Antigüedad: 22 años, 5 meses
Puntos: 2
Pues si..........
muchas gracias.......
habia tratado eliminando los espacios pero parece que no los habia eliminado muy bien....

JmN
__________________
JmN
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 01:23.