Tema: Error en php
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/07/2013, 17:37
martinpandolfelli
 
Fecha de Ingreso: julio-2013
Mensajes: 31
Antigüedad: 10 años, 9 meses
Puntos: 0
Error en php

Hola! estoy teniendo un problema y necesito resolverlo urgente!!

tengo este codigo

Código PHP:
Ver original
  1. <?php
  2.                    
  3.                         //conexion
  4.                        
  5.     $conexion=mysql_connect ("xxx", "xxx", "xx");
  6.         if (!$conexion) die ("Error al conectarse con la base de datos");
  7.  
  8.     $res=mysql_select_db("xxx", $conexion);
  9.         if(!$res)die( "Error al seleccionar el base de datos");
  10.                    
  11.                         $empleado_busqueda=$_POST['empleado'];
  12.                
  13.                 if($_SERVER['REQUEST_METHOD']=='POST'){
  14.                     //hago la consulta filtrada por auto
  15.  
  16.                     $sql ="SELECT id,imagen,remarquable,marque,modele,version,anne,kilometrage,prix,etat FROM cars WHERE marque like '%$empleado_busqueda%'";
  17.                     $rs=mysql_query($sql);
  18.                     $ver=mysql_fetch_assoc($rs);
  19.                     $hay_imagen = $ver['imagen'];
  20.                     if(!$rs) die("Error en sql:" .mysql_error());
  21.                     $esprimerafila=true;
  22.  
  23.                     //muestro los resultados
  24.                
  25.                 echo "<table style='padding:1px;font-family:Calibri;width:100%;'  cellpadding='4' cellspacing='4' class='table'>";
  26.                     while ($fila=mysql_fetch_assoc($rs)) {
  27.                         if ($esprimerafila){
  28.                        
  29.                             echo "<tr>";
  30.                             foreach($fila as $campo=>$valor){
  31.                                 echo "<td bgcolor='#c5e2f5'><b>", strtoupper( $campo), "</b></td>";
  32.                             }
  33.                             $esprimerafila=false;
  34.                             echo "</tr>";
  35.                         }
  36.                         echo "<tr class='td-hover'>";
  37.                         foreach($fila as $campo=>$valor){
  38.                                 echo "<td>";
  39.                             if($campo=='imagen'){
  40.                             echo "<img width='150' src='uploads/",$valor,"'/>";
  41.                    
  42.                                 }else{
  43.  
  44.                             if($valor=='Si'){
  45.                             echo "<img width='20' src='images/destacado.gif'/>";
  46.                    
  47.                                 }else{
  48.                             echo $valor;}
  49.    
  50.                             echo "</td>";
  51.                            
  52.                         }
  53.                        
  54.                         //editar
  55.                             echo "<td width='100' style='background-color:#efefef;padding:4px;'>";
  56.                             echo '<a style ="text-decoration:none;color:#555;" title="&Eacute;diter" href="modificar_auto.php?codauto=',$fila['id'],'">';
  57.                             echo '<img src="images/edit.png" border="0" width="15"/>&Eacute;diter';
  58.                             echo "</a>";
  59.                             echo "</td>";
  60.                            
  61.                         //borrar
  62.                             echo "<td width='100' style='background-color:#efefef;padding:4px;'>";
  63.                             echo "<a style ='text-decoration:none;color:#555;' title='Supprimer' href='borrar_auto.php?codauto=",$fila['id'],"' onClick='return confirm(\"Desea borrar el auto?\");'>";
  64.                             echo '<img src="images/borrar.png" border="0" width="15"/>Supprimer';
  65.                             echo "</a>";
  66.                             echo "</td>";
  67.                             echo "</tr>";
  68.                             }  
  69.                        
  70.                             echo "</table>";
  71.                            
  72.                             $total=mysql_num_rows($rs);
  73.                             echo "<div class='total-registros'> </br> Total des fichiers $total</div>";
  74.                        
  75.                             }else{
  76.                
  77.                            
  78.                            
  79.                             //hago la consulta empleados
  80.                    
  81.                     $sql ="SELECT id,imagen,remarquable,marque,modele,version,anne,kilometrage,prix,etat FROM cars";
  82.                     $rs=mysql_query($sql);
  83.  
  84.                     if(!$rs) die("Error en sql:" .mysql_error());
  85.                     $esprimerafila=true;
  86.  
  87.                     //muestro los resultados
  88.                 echo "<table style='padding:1px;font-family:Calibri;width:100%;'  cellpadding='4' cellspacing='4' class='table'>";
  89.                     while ($fila=mysql_fetch_assoc($rs)) {
  90.                         if ($esprimerafila){
  91.                        
  92.                             echo "<tr>";
  93.                             foreach($fila as $campo=>$valor){
  94.                                 echo "<td bgcolor='#c5e2f5'><b>", strtoupper( $campo), "</b></td>";
  95.                             }
  96.                             $esprimerafila=false;
  97.                             echo "</tr>";
  98.                         }
  99.                         echo "<tr class='td-hover'>";
  100.                         foreach($fila as $campo=>$valor){
  101.                                 echo "<td>";
  102.                             if($campo=='imagen'){
  103.                             echo "<img width='150' src='uploads/",$valor,"'/>";
  104.                    
  105.                                 }else{
  106.  
  107.                             if($valor=='Si'){
  108.                             echo "<img width='20' src='images/destacado.gif'/>";
  109.                    
  110.                                 }else{
  111.                             echo $valor;}
  112.    
  113.                             echo "</td>";
  114.                            
  115.                         }
  116.                        
  117.                         //editar
  118.                             echo "<td width='100' style='background-color:#efefef;padding:4px;'>";
  119.                             echo '<a style ="text-decoration:none;color:#555;" title="&Eacute;diter" href="modificar_auto.php?codauto=',$fila['id'],'">';
  120.                             echo '<img src="images/edit.png" border="0" width="15"/>&Eacute;diter';
  121.                             echo "</a>";
  122.                             echo "</td>";
  123.                            
  124.                         //borrar
  125.                             echo "<td width='100' style='background-color:#efefef;padding:4px;'>";
  126.                             echo "<a style ='text-decoration:none;color:#555;' title='Supprimer' href='borrar_auto.php?codauto=",$fila['id'],"' onClick='return confirm(\"Desea borrar el auto?\");'>";
  127.                             echo '<img src="images/borrar.png" border="0" width="15"/>Supprimer';
  128.                             echo "</a>";
  129.                             echo "</td>";
  130.                             echo "</tr>";
  131.                             }  
  132.                        
  133.                             echo "</table>";
  134.                            
  135.                             $total=mysql_num_rows($rs);
  136.                             echo "<div class='total-registros'> </br> Total des fichiers $total</div>";
  137.  
  138.         }}
  139. ?>


y me sale este error

Parse error: syntax error, unexpected T_ELSE in /usr/www/virtual/tiffany/www.autosglobale.com/admin/inc/empleados.php on line 81

tienen idea porque es? quizas tengo algo mal cerrado poer la verdad es q no me doy cuentaa!!

Última edición por Triby; 14/07/2013 a las 17:58 Razón: código en highlight