Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/03/2010, 05:43
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

jaja no me preguntes para que lo tengo..porque no tengo ni idea, a mi me dijeron que lo pusiera y yo lo puse xD

es igual ya lo he conseguido hacer.

dejo el codigo por si a alguien le interesa.
Código PHP:
<?php 
session_start
(); 
require (
'db_connect.php'); 
require (
'functions.php'); 
connectar_imc(); 
?> 
<form action = "recuento_clientes.php" method = "post"> 
<?php 
    
     
    
echo "<select name=\"year\" id=\"year\">"
    for(
$i=date(Y);$i>=2005;$i--) { 
        echo 
"<option value=\"".$i."\""
        if(
$_POST['year']==$i) echo " selected"
        echo 
">".$i."</option>"
    } 
    echo 
"</select>"
    echo 
"&nbsp;<input id=\"button\" name=\"enviar\" class=\"boton\" type=\"submit\" value=\"Ver\" "
?> 
    </form> 

<?php 
if( $_POST ){       
     
    echo 
"<table border='1'>"
    echo 
"<tr><td><b>Distribuidores</b></td><td><b>Enero</b></td><td><b>Febrero</b></td><td><b>Marzo</b></td><td><b>Abril</b></td><td><b>Mayo</b></td><td><b>Junio</b></td><td><b>Julio</b></td><td><b>Agosto</b></td><td><b>Septiembre</b></td><td><b>Octubre</b></td><td><b>Noviembre</b></td><td><b>Diciembre</b></td></tr>"


        
$query_dis=("SELECT id_distributor, distributor_name FROM distributor WHERE deleted_distributor = '0' order by distributor_name"); 
        
$result_dis=(mysql_query($query_dis)); 
        
    
$max[]=0;
    
$max_dist[]=0;

        while (
$rows mysql_fetch_row($result_dis)){ 
            echo 
"<tr>"
        
            echo 
"<td>";          
            echo 
"<b>$rows[1]</b><br><br>"
            echo 
"</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";     
        
                echo 
"<td>"
                echo 
"<b>ALTAS :</b><br>"
                
$query=("SELECT COUNT(client_name), registration_date, SUM(contracted_space/1073741824),id_distributor, id_pay_method, type_of_client, id_client FROM client WHERE id_distributor = '".$rows[0]."'  AND registration_date >= '".$desde."' and registration_date <= '".$hasta."' and demo_account = '0' order by count(client_name)"); 
                
$resultmysql_query($query) or die (mysql_error()); 
                while(
$row=mysql_fetch_array($result)) { 
                        if(
$row[0]==0){ 
                            echo 
"Clientes: 0<br>Espacio:&nbsp; 0GB<br><br>";
                
                        }else{ 
                            echo   
"Clientes:&nbsp;" .$row[0]."<br>"
                            
"Espacio:&nbsp;".$row[2]."&nbsp;GB<br><br>";      
                        } 
            
            if(
$row[2]>$max[$i]) {
                
$max[$i]=$row[2];
                
$max_dist[$i]=$row[3];
            }
            
                 
                }     
                echo 
"</td>";           
            }
            
            echo 
"</tr>";      
       }   

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

    for(
$i=1;$i<=12;$i++) { 
                 echo 
"<td>".$max_dist[$i]."</td>";
          }    
        echo 
"</td>";
        echo 
"</tr>";

?>