Good people i finish thanks everyone!! this script finished:

<?

include("tempconex.php");

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

do {

### comienzo script de conexion ###

$queEmp = "SELECT numero, mensaje FROM mensajes WHERE estado is NULL";
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
if ($resEmp == true) {
     while ($rowEmp = mysql_fetch_assoc($resEmp)) {
     $numero = $rowEmp['numero'];
     $mensaje  = $rowEmp['mensaje'];

### comienza el break  ###

     }
     sleep(13);
     $comando = exec('datos.log | grep "Error 500"');

     if($comando == TRUE){
     echo " error encontrado NO SE ENVIA! SE BORRA Y PAUSA 30 SEG | ";
     #mysql_query("UPDATE mensajes SET estado = 'no enviado', date = NOW()
WHERE numero = $numero", ($conexion));
     exec('cat /dev/null > 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... <alexissauc...@gmail.com>

> 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
>

Reply via email to