Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/03/2015, 02:03
Avatar de fbedia
fbedia
 
Fecha de Ingreso: julio-2010
Mensajes: 159
Antigüedad: 13 años, 9 meses
Puntos: 8
Respuesta: consulta sobre php y mysql

Tal como lo planteas parece sencillo...
¿Que tal algo así?

Código PHP:
Ver original
  1. $consulta = "SELECT valor, interes FROM tabla";
  2. $total = 0;
  3. if ($resultado = $mysqli->query($consulta)) {
  4.  
  5.     while ($fila = $resultado->fetch_assoc()) {
  6.          $total = (($fila["valor"]*$fila["interes"])/100)+$total;
  7.     }
  8.  
  9.     $resultado->free();
  10. }
  11. echo $total;
__________________
Follow me on twitter @franbedia