Foros del Web » Programando para Internet » PHP »

AYUDA - Parse error: syntax error

Estas en el tema de AYUDA - Parse error: syntax error en el foro de PHP en Foros del Web. Saludos tengo un problema q no entiendo... segun el mensaje Parse error: syntax error, unexpected $end in C:\wamp\www\incomed\html\panel\act_prod2.php on line 246 es de sintaxis... pero ...
  #1 (permalink)  
Antiguo 06/02/2008, 08:02
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
AYUDA - Parse error: syntax error

Saludos tengo un problema q no entiendo... segun el mensaje
Parse error: syntax error, unexpected $end in C:\wamp\www\incomed\html\panel\act_prod2.php on line 246

es de sintaxis... pero veo q el codigo esta bien... al menos eso creo...

es un panel de actualización de datos...

aqui les dejo el codigo
Código PHP:
<?php require_once('../Connections/incomed.php'); ?>
<?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")) {

if (
$_POST['opcion']==1){
$ediciondir'../images2/';  
$uploaddir=$ediciondir;
if (!
is_dir($ediciondir)) {     mkdir($uploaddir0777);    }
move_uploaded_file($_FILES['imgprinc']['tmp_name'], $uploaddir $_FILES['imgprinc']['name']);    
$filename $_FILES['imgprinc']['name'];}
else {
$filename $_POST['imgprinc'];

if (
$_POST['opcion']==1){
$ediciondir'../images2/';  
$uploaddir=$ediciondir;
if (!
is_dir($ediciondir)) {     mkdir($uploaddir0777);    }
move_uploaded_file($_FILES['flash']['tmp_name'], $uploaddir $_FILES['flash']['name']);    
$filename2 $_FILES['flash']['name'];}
else {
$filename2 $_POST['flash'];
}


  
$updateSQL sprintf("UPDATE productos SET titulo=%s, comen=%s, imgprinc=%s, flash=%s WHERE id=%s",
                       
GetSQLValueString($_POST['titulo'], "text"),                       
                       
GetSQLValueString($_POST['comen'], "text"),
                       
GetSQLValueString($filename"text"),
                       
GetSQLValueString($filename2"text"),
                       
GetSQLValueString($_POST['id'], "int"));

 
mysql_select_db($database_incomed$incomed);
 
$Result1 mysql_query($updateSQL$incomed) or die(mysql_error());

  
$updateGoTo "listproducto.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
 
header(sprintf("Location: %s"$updateGoTo));
}
$colname_Recordset1 "1";
if (isset(
$_GET['id'])) {
  
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_incomed$incomed);
$query_Recordset1 sprintf("SELECT * FROM productos WHERE id = %s"$colname_Recordset1);
$Recordset1 mysql_query($query_Recordset1$incomed) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);

?>
<script language="javascript" type="text/javascript">
function validar_archivo(archivo) {
    var error_archivo;
    error_archivo=0;
      var file=archivo.value;
      
          if (file=="")
          { error_archivo=1; }
          //texto += "\n\nIngrese Foto"
            else{
             
                 // file=document.formulario.FOTO.value
               extArray = new Array(".gif",".jpg",".swf");
               // Extension de archivos permitidos
               allowSubmit = false;
                 if (!file) return;

                   while (file.indexOf("\\") != -1)
                       file = file.slice(file.indexOf("\\") + 1);
                       ext = file.slice(file.indexOf(".")).toLowerCase();
                   
                   for (var i=0; i < extArray.length; i++){
                          if (extArray[i] == ext){
                             allowSubmit = true;
                             break;
                            }
                    }

                        if (!allowSubmit) {
                         error_archivo=2;
                        // texto += "\n\nFOTO: solo admite archivo con la extensión ''gif, .jpeg , .jpg''";
                         }
                            }
                            return error_archivo;
}



</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es requerido.\n'; }
  } 
  
  var ar;
  var ar, celest;
  ar=document.form1.imagen;
  celest=validar_archivo(ar);
  if (celest==1){errors+="- Imagen es  requerido";}
  if (celest==2){errors+="- Nota: Solo admiten archivos para la imagen con la extensión ''gif, .jpeg , .jpg'";}
  
    if (errors) alert('Han ocurrido los siguientes errores:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>

<body bgcolor="#ffffff">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="../images/panel_head.jpg" alt="" width="500" height="130" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" bgcolor="#FFFFFF"><p class="textopanel">&nbsp;</p>
            <p class="textopanel"> Ingresar Productos</p>          <p class="textopanel"><form action="<?php echo $editFormAction?>" method="post" enctype="multipart/form-data" name="form1" onSubmit="MM_validateForm('descripcion','','R');return document.MM_returnValue">
              <table align="center">
                <tr valign="middle">
                  <td width="98" height="21" align="left" nowrap class="tituloINDEX">Codigo</td>
                  <td width="267" align="left"><input name="codigo" type="text" class="todopanel" id="codigo" value="<?php echo $row_Recordset1['titulo']; ?>"></td>
                </tr>
                <tr valign="middle">
                  <td height="147" align="left" nowrap class="tituloINDEX">Descripcion:</td>
                  <td align="left"><textarea name="descripcion" cols="50" rows="10" class="todopanel" ><?php echo $row_Recordset1['comen']; ?></textarea></td>
                </tr>
                <tr valign="middle">
                  <td colspan="2" align="left" nowrap class="Estilo8"><span class="tituloINDEX">Actualizar Imagen?  Si
                    <input name="opcion" type="radio" value="1">
                    /No</span><span class="todopanel">
                    <input name="opcion" type="radio" value="0" checked>
                    <input name="imgprinc" type="hidden" class="todopanel" value="<?php echo $row_Recordset1['imgprinc']; ?>" size="32">
                    <input name="imgprinc" type="file" class="todopanel" id="imgprinc">
                    </span></td>
                  </tr>
                <tr valign="baseline" bordercolor="#CCCCCC">
                  <td align="left" valign="top" class="tituloINDEX">Flash:</td>
                  <td><input name="flash" type="file" class="textoINDEX" id="flash"  enctype="multipart/form-data" value="<?php echo $row_Recordset1['flash']; ?>" /></td>
                </tr>
                <tr valign="middle">
                  <td colspan="2" align="center" nowrap>&nbsp;</td>
                  </tr>
                <tr valign="middle">
                  <td colspan="2" align="left" nowrap> <input type="hidden" name="MM_update" value="form1">
                    <input type="hidden" name="id" value="<?php echo $row_Recordset1['id']; ?>"></td>
                  </tr>
                <tr valign="middle">
                  <td align="left" nowrap>&nbsp;</td>
                  <td align="left"><input name="submit" type="submit" class="todopanel" value="Actualizar registro">                      </td>
                </tr>
                </table>
                </form> </p></td>
        </tr>
      
      <tr>
        <td></td>
        </tr>
    </table></td>
  </tr>
  
  <tr>
    <td align="center"><span class="textopie">Incomed, C.A. Todos los derechos reservados 2008.</span></td>
  </tr>
</table>

<?
mysql_free_result
($Recordset1);
 
?> <- linea 246
Gracias!!!
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...

Última edición por T4ke0veR; 06/02/2008 a las 08:10
  #2 (permalink)  
Antiguo 06/02/2008, 08:41
Avatar de Carlojas  
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 10 meses
Puntos: 49
Re: AYUDA - Parse error: syntax error

Por lo que veo parece que no estas cerrando la etiqueta body y estas estas poniendo un </table> de mas, revisalo con cuidado y veras

Saludos.
  #3 (permalink)  
Antiguo 06/02/2008, 08:55
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Re: AYUDA - Parse error: syntax error

no no.. esas etiquetas las elimine por cuestion d espacio en el foro disculpen la confusion
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...
  #4 (permalink)  
Antiguo 06/02/2008, 09:25
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: AYUDA - Parse error: syntax error

El error:
Código:
Parse error: syntax error, unexpected $end in C:\wamp\www\incomed\html\panel\act_prod2.php on line 246
Significa que dejaste una llave { abierta y no la cerraste, por eso llego al "fin" del documento y no encontro una llave de cierre y por ende te marca el error.

Saludos.
  #5 (permalink)  
Antiguo 06/02/2008, 10:21
Avatar de helder  
Fecha de Ingreso: agosto-2007
Ubicación: Colombia
Mensajes: 50
Antigüedad: 16 años, 8 meses
Puntos: 1
Re: AYUDA - Parse error: syntax error

el error es el que dije GatorV y te ayudo mas la llave que te falta cerrar es la de la linea 33 debes cerrarlo
la linea completa es esta
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { << cierralo segun entiendo el codigo el cierre debe ir en la linea 81 al final de tu script php

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 09:59.