[PHP] Re: bucle while for to msqyl

2012-09-17 Thread El Ale...
Good people i finish thanks everyone!! this script finished:

 datos.log');
 sleep(30);
 echo " se reanuda | ";

### termina el break ###

 }
 else
 {

### comienza el envio de el mensaje ya que no se encontro ningun error en
los logs ###

 echo " Se prepara | ";
 exec("comando de envio");
 echo " ya se envio (no se encontro ningun error) | ";
 #mysql_query("UPDATE mensajes SET estado = 'enviado', date = NOW()
WHERE numero = $numero", ($conexion));


### finaliza el envio ###

}
   }

### fin script de conexion ###

} while ($stop == true);
continue;
break;
?>

its run good!, but i have one last problem, i cant if while is true
: SELECT estado FROM mensajes WHERE estado is NOT NULL play if false not
run this, im need if estado from mensajes is true loop the script but if
not break this.

I tried:

$stop = "SELECT estado FROM mensajes WHERE estado is NOT NULL";

y el while:

} while ($stop == true);
continue;
break;

but not run.

Thanks everyone!!

2012/9/16 El Ale... 

> hi! im new in this forum, i not speak very good english, apologise im
> spanish.
> I have a problem, need one infinit bucle to mysql only "true" if "false"
> break this, for example:
>
> prueba.php:
>
>  include("conexion.php");
>
> do {
>
>
> echo "$numero";
> sleep(1);
>
>
> if ($numero == 1)
> reset;
> continue;
> break;
> } while (true);
>
> ?>
>
> 3
>
> connect to mysql
>
> conexion.php:
>
> 
> $conexion = mysql_connect("localhost", "alexis", "123456");
> mysql_select_db("probando", $conexion);
> $queEmp = "SELECT n FROM numero WHERE n LIKE 1";
> $resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
> $totEmp = mysql_num_rows($resEmp);
> if ($totEmp> 0) {
>  while ($rowEmp = mysql_fetch_assoc($resEmp)) {
>  $numero = $rowEmp['n'];
>
> }
> echo "$numero";
> }
> mysql_close($conexion);
> ?>
>
> What I do is to run the loop as long as the value "$ number" is equal to
> "1" in mysql I have a single field called "n" with the value "1" and runs,
> now the problem is the next, I run the loop with the value "1" in mysql and
> it runs fine but when I go to mysql and change the value to "2" (which
> would be an incorrect and should leave) the loop ignores him and continues
> running, I was reading a lot about the loops but I can not make it work in
> this way could you please give me a hand with this? or if I'm wrong What
> else I can do an infinite command if it fulfills a function and if they do
> not?.
>
> Best regards
>


[PHP] Re: bucle while for to msqyl

2012-09-16 Thread El Ale...
Now what I need is a loop that fence mysql collecting and updating
information automatically and when no more data to update not run more as I
show in the first script, try to do with this do while loop but it works
for me as it reads the first data and others do not follow, is as to ignore
the other data and only read the first but the condition is false. I hope
to be clear and thousand apologies if it were not so

this other example this is a script for masive sms sender:

mysql database: prueba

table: sms
date1: number
date2: message
date43condition

insert into sms:

0383315681515;"this is a test";1

0383315681515: it s phone number
"this is a test": message
condition =
1: its for send
2:send
3:not send



my script send sms:





my script conexion.php:

 0) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
 $number = $rowEmp['number'];
 $message = $rowEmp['message'];
}
   }

mysql_close($conexion);
?>