Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/11/2012, 15:35
rolygc
 
Fecha de Ingreso: abril-2009
Ubicación: en un lugar de la mancha
Mensajes: 236
Antigüedad: 17 años, 5 meses
Puntos: 38
Respuesta: Agrupar registros

Código PHP:
function cantidadPuntos($puntuacion)
    {
        
$query = mysql_query("SELECT ID FROM t_motivo WHERE puntuacion = '$puntuacion'");
        return 
mysql_num_rows($query);
    }
    
    
$puntuacionFinal = array();
    
    for (
$c = 0; $c <= 10; $c++)
    {
        
$id = cantidadPuntos($c);
        
$puntuacionFinal[] .= $id; 
        
        if ( 
$puntuacionFinal[$c] != 0)
        {
            echo 
'Puntuacion ' . $c . ': ' . $puntuacionFinal[$c] .  ' Registros <br />';
        }
    }