Foros del Web » Creando para Internet » Diseño web »

Parse error: syntax error, unexpected $end in

Estas en el tema de Parse error: syntax error, unexpected $end in en el foro de Diseño web en Foros del Web. Hola a todos tengo unos errores en este codigo si alguien me pudiera ayudar me da este error Parse error: syntax error, unexpected $end in ...
  #1 (permalink)  
Antiguo 24/01/2009, 14:19
 
Fecha de Ingreso: enero-2009
Mensajes: 4
Antigüedad: 17 años, 10 meses
Puntos: 0
Parse error: syntax error, unexpected $end in

Hola a todos tengo unos errores en este codigo si alguien me pudiera ayudar me da este error Parse error: syntax error, unexpected $end in /home2/domainsc/public_html/core/products-admin.php on line 1
el codigo es el siguiente aunque pone en linea 1 es que donde lo tengo todo el codigo es solo una linea muchisimas gracias
Código PHP:
<?php 
if( !function_exists( 'saveProduct' ) ){   function saveProduct( $aForm ){      
if( 
is_numeric( $aForm['iProduct'] ) ){      
if( isset( 
$aForm['aFilesDescriptionChange'] ) 
&& 
is_array( $aForm['aFilesDescriptionChange'] ) ){        
foreach( 
$aForm['aFilesDescriptionChange'] as $iKey => $sValue ){          
dbChangeFileData( Array( $iKey, $aForm['iProduct'], 
$aForm['aFilesNameChange'][$iKey], 
changeTxt( ereg_replace( '\'', '', $sValue ) )
, 
$aForm['aFilesType'][$iKey], $aForm['aFilesPositionChange']
[
$iKey] ), 1 );        }       }      $bExist = true;    }    
else{      
$bExist = null;      $aForm['iProduct'] = throwLastId( ) + 1;    }    
if( !isset( 
$aForm['iPosition'] ) || !is_numeric( $aForm['iPosition'] )
 || 
$aForm['iPosition'] < -99 || $aForm['iPosition'] > 999 ) 
 
$aForm['iPosition'] = 0;    $aForm['sDescriptionShort'] = 
changeTxt( $aForm['sDescriptionShort'], 'Nds' );    
$aForm['sDescriptionFull']  = changeTxt( $aForm['sDescriptionFull'], 'Nds' );
    
$aForm['sName']  = changeTxt( $aForm['sName'] );    $aForm['fPrice'] = 
tPrice( $aForm['fPrice'] );    
if( isset( 
$aForm['aDelFiles'] ) && is_array( $aForm['aDelFiles'] ) ){
      
$iCount = count( $aForm['aDelFiles'] );     
 for( 
$i = 0; $i < $iCount; $i++ )        delFile( $aForm['aDelFiles'][$i], 1 );    }   
 if( isset( 
$aForm['aCategories'] ) && is_array( $aForm['aCategories'] ) ){
      
$bErase = true;      $iCount = count( $aForm['aCategories'] );      
for( 
$i = 0; $i < $iCount; $i++ ){       
 if( 
is_numeric( $aForm['aCategories'][$i] ) ){          
dbAddCategoriesProduct( $aForm['aCategories'] 
[
$i], $aForm['iProduct'], $bErase );          $bErase = null;
        }      }     }    
addFiles( $aForm, $aForm['iProduct'], PRODUCTS_PHOTO_SIZE, 1 );
    
dbAddProductExtensions( Array( $aForm['iProduct'], $aForm['sDescriptionFull'] ) ); 
   
dbSaveProduct( $aForm, $bExist );  } // end function saveProduct}
if( !function_exists( 'delProduct' ) ){  function delProduct( $iProduct ){
    
delFiles( $iProduct, 1 );    dbDelProduct( $iProduct );  } // end function delProduct}?>

Última edición por cesanago; 24/01/2009 a las 16:05
  #2 (permalink)  
Antiguo 24/01/2009, 14:33
Avatar de hgp147  
Fecha de Ingreso: diciembre-2006
Ubicación: Buenos Aires, Argentina
Mensajes: 980
Antigüedad: 20 años
Puntos: 36
Respuesta: Parse error: syntax error, unexpected $end in

Este post va en PHP, el problema es que te falta cerrar una llave }.

Sería mas facil encontrar el error si colocas el código en varias lineas y no todo en una.
__________________
Spread Firefox | Download Day 2008
¡Únete en nuestra misión para alcanzar el Record Guinness al software más descargado en 24 horas! http://www.spreadfirefox.com/es-ES/worldrecord/
  #3 (permalink)  
Antiguo 24/01/2009, 14:42
Avatar de hgp147  
Fecha de Ingreso: diciembre-2006
Ubicación: Buenos Aires, Argentina
Mensajes: 980
Antigüedad: 20 años
Puntos: 36
Respuesta: Parse error: syntax error, unexpected $end in

Acá tenes el código más legible:

Código PHP:
<?php 
if( !function_exists( 'saveProduct' ) ){
/** * Save product * @return void * @param array $aForm */ 
function saveProduct( $aForm ){
if( 
is_numeric( $aForm['iProduct'] ) ){
if( isset( 
$aForm['aFilesDescriptionChange'] ) && is_array( $aForm['aFilesDescriptionChange'] ) ){
foreach( 
$aForm['aFilesDescriptionChange'] as $iKey => $sValue ){
dbChangeFileData( Array( $iKey, $aForm['iProduct'], $aForm['aFilesNameChange'][$iKey], changeTxt( ereg_replace( '\'', '', $sValue ) ), $aForm['aFilesType'][$iKey], $aForm['aFilesPositionChange'][$iKey] ), 1 );
} 
// end foreach 

} $bExist = true;
} else{
$bExist = null;
$aForm['iProduct'] = throwLastId( ) + 1;
} if( !isset( 
$aForm['iPosition'] ) || !is_numeric( $aForm['iPosition'] ) || $aForm['iPosition'] < -99 || $aForm['iPosition'] > 999 ) $aForm['iPosition'] = 0;
$aForm['sDescriptionShort'] = changeTxt( $aForm['sDescriptionShort'], 'Nds' );
$aForm['sDescriptionFull'] = changeTxt( $aForm['sDescriptionFull'], 'Nds' );
$aForm['sName'] = changeTxt( $aForm['sName'] );
$aForm['fPrice'] = tPrice( $aForm['fPrice'] );
if( isset( 
$aForm['aDelFiles'] ) && is_array( $aForm['aDelFiles'] ) ){
$iCount = count( $aForm['aDelFiles'] );
for( 
$i = 0;
$i < $iCount;
$i++ ) delFile( $aForm['aDelFiles'][$i], 1 );
} if( isset( 
$aForm['aCategories'] ) && is_array( $aForm['aCategories'] ) ){
$bErase = true;
$iCount = count( $aForm['aCategories'] );
for( 
$i = 0;
$i < $iCount;
$i++ ){
if( 
is_numeric( $aForm['aCategories'][$i] ) ){
dbAddCategoriesProduct( $aForm['aCategories'][$i], $aForm['iProduct'], $bErase );
$bErase = null;
} } 
// end for 
} addFiles( $aForm, $aForm['iProduct'], PRODUCTS_PHOTO_SIZE, 1 );
dbAddProductExtensions( Array( $aForm['iProduct'], $aForm['sDescriptionFull'] ) );
dbSaveProduct( $aForm, $bExist );
} 
// end function saveProduct

}if( !function_exists( 'delProduct' ) ){
/** * Delete product * @return void * @param int $iProduct */ 
function delProduct( $iProduct ){
delFiles( $iProduct, 1 );
dbDelProduct( $iProduct );
} 
// end function delProduct

}

?>
__________________
Spread Firefox | Download Day 2008
¡Únete en nuestra misión para alcanzar el Record Guinness al software más descargado en 24 horas! http://www.spreadfirefox.com/es-ES/worldrecord/
  #4 (permalink)  
Antiguo 24/01/2009, 16:06
 
Fecha de Ingreso: enero-2009
Mensajes: 4
Antigüedad: 17 años, 10 meses
Puntos: 0
Respuesta: Parse error: syntax error, unexpected $end in

Cita:
Iniciado por hgp147 Ver Mensaje
Acá tenes el código más legible:

Código PHP:
<?php 
if( !function_exists( 'saveProduct' ) ){
/** * Save product * @return void * @param array $aForm */ 
function saveProduct( $aForm ){
if( 
is_numeric( $aForm['iProduct'] ) ){
if( isset( 
$aForm['aFilesDescriptionChange'] ) && is_array( $aForm['aFilesDescriptionChange'] ) ){
foreach( 
$aForm['aFilesDescriptionChange'] as $iKey => $sValue ){
dbChangeFileData( Array( $iKey, $aForm['iProduct'], $aForm['aFilesNameChange'][$iKey], changeTxt( ereg_replace( '\'', '', $sValue ) ), $aForm['aFilesType'][$iKey], $aForm['aFilesPositionChange'][$iKey] ), 1 );
} 
// end foreach 

} $bExist = true;
} else{
$bExist = null;
$aForm['iProduct'] = throwLastId( ) + 1;
} if( !isset( 
$aForm['iPosition'] ) || !is_numeric( $aForm['iPosition'] ) || $aForm['iPosition'] < -99 || $aForm['iPosition'] > 999 ) $aForm['iPosition'] = 0;
$aForm['sDescriptionShort'] = changeTxt( $aForm['sDescriptionShort'], 'Nds' );
$aForm['sDescriptionFull'] = changeTxt( $aForm['sDescriptionFull'], 'Nds' );
$aForm['sName'] = changeTxt( $aForm['sName'] );
$aForm['fPrice'] = tPrice( $aForm['fPrice'] );
if( isset( 
$aForm['aDelFiles'] ) && is_array( $aForm['aDelFiles'] ) ){
$iCount = count( $aForm['aDelFiles'] );
for( 
$i = 0;
$i < $iCount;
$i++ ) delFile( $aForm['aDelFiles'][$i], 1 );
} if( isset( 
$aForm['aCategories'] ) && is_array( $aForm['aCategories'] ) ){
$bErase = true;
$iCount = count( $aForm['aCategories'] );
for( 
$i = 0;
$i < $iCount;
$i++ ){
if( 
is_numeric( $aForm['aCategories'][$i] ) ){
dbAddCategoriesProduct( $aForm['aCategories'][$i], $aForm['iProduct'], $bErase );
$bErase = null;
} } 
// end for 
} addFiles( $aForm, $aForm['iProduct'], PRODUCTS_PHOTO_SIZE, 1 );
dbAddProductExtensions( Array( $aForm['iProduct'], $aForm['sDescriptionFull'] ) );
dbSaveProduct( $aForm, $bExist );
} 
// end function saveProduct

}if( !function_exists( 'delProduct' ) ){
/** * Delete product * @return void * @param int $iProduct */ 
function delProduct( $iProduct ){
delFiles( $iProduct, 1 );
dbDelProduct( $iProduct );
} 
// end function delProduct

}

?>
  #5 (permalink)  
Antiguo 24/01/2009, 16:08
 
Fecha de Ingreso: enero-2009
Mensajes: 4
Antigüedad: 17 años, 10 meses
Puntos: 0
Respuesta: Parse error: syntax error, unexpected $end in

Muchisimas gracias eres el mejor gracias muchisimas gracias
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 20:54.