Re: bucle while for to msqyl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

<?php
include("conexion.php");

do {
{
echo 'message send':
exec('sender.py'); ///this a command to ejectute sms
mysql_query("UPDATE message SET condition = '2'  WHERE number = $number",
($conexion));
}
else
{
echo 'message not send';
mysql_query("UPDATE menssage SET condition = '3' WHERE number = $number",
($conexion));

if($totEmp == TRUE)

continue;
      break;

}while(true);

?>

####################################################################

my script conexion.php:

<?

$conexion = mysql_connect("localhost", "alexis", "1234555");
            mysql_select_db("prueba", $conexion);
$queEmp = "SELECT number, message FROM sms WHERE condition 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)) {
     $number = $rowEmp['number'];
     $message = $rowEmp['message'];
    }
   }

mysql_close($conexion);
?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux