Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/11/2010, 00:43
Avatar de Threepwood
Threepwood
 
Fecha de Ingreso: febrero-2002
Ubicación: Argentina
Mensajes: 906
Antigüedad: 22 años, 2 meses
Puntos: 4
Respuesta: valoracion de Articulos... (la formula no me funciona)

Yo lo tengo implementado así:

Código PHP:


                $total_ratings 
$row['total_ratings'];
        
$total_rating $row['total_rating'];
        
$current_rating $row['rating'];

        
$new_total_rating $total_rating $rating;
        
$new_total_ratings $total_ratings 1;
        
$new_rating $new_total_rating $new_total_ratings;



        
mysql_query("UPDATE links SET total_rating = '".$new_total_rating."' WHERE id = '".$id."'") or die(mysql_error());
        
mysql_query("UPDATE links SET rating = '".$new_rating."' WHERE id = '".$id."'") or die(mysql_error());
        
mysql_query("UPDATE links SET total_ratings = '".$new_total_ratings."' WHERE id = '".$id."'") or die(mysql_error()); 
Donde $total_ratings es el numero de votos y $total_rating la calificación total.
__________________
Equívocos sin importancia