Ver Mensaje Individual
  #2 (permalink)  
Antiguo 01/03/2010, 05:02
marinesky
 
Fecha de Ingreso: diciembre-2009
Ubicación: entre Ibiza y Barcelona :)
Mensajes: 92
Antigüedad: 14 años, 4 meses
Puntos: 3
Respuesta: mostrar cual es el valor mas grande

ok ya he conseguido que me muestre el mas grande.. pero en algunos meses no hay registro y aun asi me muestra datos, como puedo hacer para que si no hay datos me muestre "no hay registro".
Código PHP:

    
echo "<tr>";
    
    echo 
"<td>Total</td>";

    for(
$i=1;$i<=12;$i++) { 
                if(
$i<10$mes="0".$i
                else 
$mes $i
                
$desde $_POST['year']."-".$mes."-01"
                
$hasta $_POST['year']."-".$mes."-31";

    
$sql=("SELECT contracted_space/1073741824, client_name, d.id_distributor, c.id_distributor, distributor_name FROM `client`c, `distributor`d WHERE c.registration_date >= '".$desde."' and c.registration_date <= '".$hasta."' ORDER BY contracted_space DESC LIMIT 1");  
    
$result_sqlmysql_query($sql) or die (mysql_error());
    
$max=0;
    
            while(
$filamysql_fetch_row($result_sql)){    
            echo 
"<td>";  
                 if(
$fila[0] > $max){          
                  
$max $fila[0];
            
$usuario$fila[1];
                  
            }
        }     
        echo 
$usuario;            
          }    
        echo 
"</td>";
        echo 
"</tr>";

?>