Ver Mensaje Individual
  #6 (permalink)  
Antiguo 13/04/2008, 17:44
luks77
 
Fecha de Ingreso: diciembre-2007
Mensajes: 274
Antigüedad: 16 años, 4 meses
Puntos: 0
Re: Error tarea programada

En el servidor tengo la base de datos(mysql), en mi servidor que es la PC, hay quiero activar la tareas programadas pero no funciona por los problemas que ya explique.

Lo que quiero hacer es que todos los dias se active un codigo.

Aca un segmento:

Código PHP:
 function db_connect()
{
   
$result = @mysql_pconnect("localhost""root""0002085523");
   if (!
$result)
      return 
false;
   if (!@
mysql_select_db("juego"))
      return 
false;

   return 
$result;
}

 
$db=db_connect();    
 
$query "select * from user";
 
$resultado mysql_query($query,$db) or die (mysql_error());
 
$row=mysql_fetch_array($resultado);    
     
 while( 
$row mysql_fetch_array$resultado ) ) 
 {
        
$ids[] = $row['id'];
       
}



for( 
$i =0$i<count$ids );$i++) 
{


 
 
 
     
 
$id=$ids[$i];    

 
 
$db=db_connect();
 
$query "select * from user where id='$id'" or die (mysql_error());
 
$resultado mysql_query($query,$db);
 
$row=mysql_fetch_array($resultado);    
 
$query="UPDATE `juego`.`entrenamiento_ayer` SET  `drive_a`= '".$row["drive"]."', 
                                                  `reves_a`= '"
.$row["reves"]."',
                                                  `voleas_d_a`= '"
.$row["voleas_d"]."',
                                                  `voleas_r_a`= '"
.$row["voleas_r"]."',
                                                  `saque_a`= '"
.$row["saque"]."',
                                                  `passing_a`= '"
.$row["passing"]."',
                                                  `smash_a`= '"
.$row["smash"]."',
                                                  `remates_a`= '"
.$row["remates"]."',
                                                  `rapidez_a`= '"
.$row["rapidez"]."',
                                                  `drop_a`= '"
.$row["drop"]."',
                                                  `slice_a`= '"
.$row["slice"]."',
                                                  `fuerza_a`= '"
.$row["fuerza"]."',
                                                  `precicion_a`= '"
.$row["precicion"]."',
                                                `inteligencia_a`= '"
.$row["inteligencia"]."',                                                   `condicion_a`= '".$row["condicion"]."',
                                                  `practica_a`= '"
.$row["practica"]."'                                                                WHERE id=$id"
 
$resultado mysql_query($query,$db) or die (mysql_error());      
     



     
     if (
$row["ent_1"]=="drive")
     {
     if (
$row["drive"]<=20)     
     {
     
$agregar1=rand(4,3);         

     }
          elseif (
$row["drive"]<=35 && $row["drive"]>20)     
     {
     
$agregar1=3;         

     }
               elseif (
$row["drive"]<=50 && $row["drive"]>35)     
     {
     
$agregar1=rand(2,3);         

     }
              
                   elseif (
$row["drive"]<=75 && $row["drive"]>50)     
     {
     
$agregar1=2;         

     }
                        elseif (
$row["drive"]<=80 && $row["drive"]>75)     
     {
     
$agregar1=rand(1,2);         

     }
                            elseif (
$row["drive"]<=90 && $row["drive"]>80)     
     {
     
$agregar1=1;         

     }
                                 elseif (
$row["drive"]<=100 && $row["drive"]>90)     
     {
     
$agregar1=rand(0,1);         

     }
     
                                      elseif (
$row["drive"]>=100)     
     {
     
$agregar1=rand(-2,-8);         

     }
    
    else
     {
    
$agregar1=rand(10,11);    
    }
     
$agregar=$row["drive"] + $agregar1;
     
     if (
$agregar>100)
   {
    
$numero=rand(-2,-3);
   
$agregar=$agregar+$numero;    
    
   }
   
    
$query="UPDATE `juego`.`user` SET `drive` = '$agregar' WHERE `user`.`id` ='$id'";
    
$resultado mysql_query($query,$db) or die (mysql_error());      
      } 


Esto quiero que se active todos los dias a la misma hora


Si alguien puede ayudarme gracias