Ver Mensaje Individual
  #7 (permalink)  
Antiguo 31/03/2008, 20:24
Avatar de insyse
insyse
 
Fecha de Ingreso: abril-2005
Ubicación: Colombia
Mensajes: 206
Antigüedad: 19 años
Puntos: 5
Re: SCRIP para generar Pines aleatorios

SI lo hice así:

Desde un formulario envio los dos datos Cantidad de pines y días vencimiento, y el script final es:


Código PHP:
<?php
if($button){

if(!
$button){
echo 
"NO HA INGRESADO NINGUNA CANTIDAD DE PINES TRATE DE VEUEVO";
die;
}else{
$i=1;
while(
$i<=$cant_pines){
$var1=rand(10009999) ;
$var2=rand(10009999) ;
$var3=rand(1099);
$var =$var1.$var2.$var3;
echo 
"<br>$var";
$sql "INSERT INTO pines VALUES ('$var', '$dias')";
$res mysql_query($sql$dbd);
$i++;
}
if(
$res){
echo 
"<p>LOS PINES FUERON CREADOS CON EXITO<br></p>";
}else{
echo 
"<p>ERROR AL GENERAR LOS PINES</p>".mysql_error(); 
}}}

?>
De esta forma me sube los pines con sus dias de vencimiento correspondientes.