Ver Mensaje Individual
  #5 (permalink)  
Antiguo 30/05/2011, 15:32
Grox
 
Fecha de Ingreso: mayo-2008
Mensajes: 82
Antigüedad: 16 años
Puntos: 3
Respuesta: hago un update pero solo me lo hace a una fila

Código PHP:
Ver original
  1. <?
  2. $conexion= mysql_connect("localhost","db", "pass");
  3. mysql_select_db("db",$conexion);////
  4. $query = "SELECT user_name FROM u_miembros WHERE user_puntos=40";
  5. $resultado = mysql_query($query,$conexion) or die(mysql_error());
  6. $total = mysql_num_rows($resultado);
  7. if ($total>0) {
  8. while ($fila = mysql_fetch_assoc($resultado))
  9. {
  10. $var = $fila['user_name'];
  11. echo "<strong>".$var."</strong><br />";
  12. $sql = "UPDATE usuarios SET puntos=5002 WHERE nick='$var'";
  13. mysql_query($sql , $conexion);
  14. }
  15. }
  16.  
  17. ?>


Fijate asi...