Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Daniel Brown
On Sep 16, 2012 4:33 PM, "El Ale..."  wrote:
>
> 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:

Que paso, Alex?

La lista de PHP en espanol es aqui:

http://php.net/mailinglists

Lo siento para me espanol.

> 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


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread tamouse mailing lists
On Sun, Sep 16, 2012 at 5:08 PM, El Ale...  wrote:
> 
> $conexion = mysql_connect("localhost", "usuario", "123456");
> mysql_select_db("probando", $conexion);
>
> function updateNumero() {
>
> $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'];
> }
> }
> return $numero;
> }
> ?>
>
> in this way?
>
> I do not understand is where the loop would do, what I need to remember is
> that if it is "true" to repeat the condition and if false stops.
>
> Thanks!
>
> 2012/9/16 Serge Fonville 
>
>> If you wrap the query inside your while loop at the point where you want
>>> to check for a change of the value it will change at every iteration.
>>
>>
>> For ease of use, it would be better to create  a function around the data
>> gathering part, i.e.
>>
>>> function updateNumero() {
>>>
>>> $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'];
>>> }
>>> }
>>>  return $numero;
>>> }
>>
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>> How could I?, should use another command? I need to do that if the value
>>> of the script is the same as the database and repeat but stops.
>>>
>>> greetings!
>>>
>>>
>>> 2012/9/16 Serge Fonville 
>>>
 Since the value is never changed inside the loop, it will run
 indefintely or stop immediately.

 You need to re-request the value from the database to change $numero to
 a possible other value.

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... 

> yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle
> break.
> when consulted database and this value is 1, the loop continues, but
> when changing the value of the database for example "value 2", the loop
> should stop because 1 is not equal to 2 but not Doing so ignores it and
> segue running as if the value is one, that's the problem
>
> Thank you!
>
>
> 2012/9/16 Serge Fonville 
>
>> Also, if $numero equals 1, it always prints 1.
>> Is that the expected behaviour?
>>
>> When it does not match 1, it does nothing except it echos 1 twice,
>> first in the  conexion.php and second in the first iteration of the
>> while loop
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>>
>>>
>>> 2012/9/16 El Ale... 
>>>
>>> Im sorry "reset;" is not, this is:

 >>> include("conexion.php");

 do {


 echo "$numero";
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?>

 Thanks!


 2012/9/16 Serge Fonville 

> Hi,
>
> if ($numero == 1)
>> reset;
>> continue;
>> break;
>> } while (true);
>
>
> If the $numero is equal to 1 reset seems odd
> reset is a function.and requires an array
> Based on your code, this would run indefintely
> Since there are no braces after the if statement, only the first
> statement is executed when $numero equals 1
>
> Also, is this your actual code?
>
> If not and possible please add that
>
> HTH
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 2012/9/16 El Ale... 
>

Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Serge Fonville
>
> I do not understand is where the loop would do, what I need to remember is
> that if it is "true" to repeat the condition and if false stops.


Well, "it depends"

Where do you want to check if the value changes?

And, perhaps more importantly, what is the problem you are trying to solve?

Since you retrieve all values from the database, but only use the last one.
Does that mean you are trying to determine if the last value has changed
(either through INSERT or UPDATE)?

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



2012/9/17 El Ale... 

> 
> $conexion = mysql_connect("localhost", "usuario", "123456");
> mysql_select_db("probando", $conexion);
>
>  function updateNumero() {
>
> $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'];
>  }
> }
>  return $numero;
> }
> ?>
>
> in this way?
>
> I do not understand is where the loop would do, what I need to remember is
> that if it is "true" to repeat the condition and if false stops.
>
> Thanks!
>
> 2012/9/16 Serge Fonville 
>
>> If you wrap the query inside your while loop at the point where you want
>>> to check for a change of the value it will change at every iteration.
>>
>>
>> For ease of use, it would be better to create  a function around the data
>> gathering part, i.e.
>>
>>> function updateNumero() {
>>>
>>> $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'];
>>> }
>>> }
>>>  return $numero;
>>> }
>>
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>> How could I?, should use another command? I need to do that if the value
>>> of the script is the same as the database and repeat but stops.
>>>
>>> greetings!
>>>
>>>
>>> 2012/9/16 Serge Fonville 
>>>
 Since the value is never changed inside the loop, it will run
 indefintely or stop immediately.

 You need to re-request the value from the database to change $numero to
 a possible other value.

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... 

> yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle
> break.
> when consulted database and this value is 1, the loop continues, but
> when changing the value of the database for example "value 2", the loop
> should stop because 1 is not equal to 2 but not Doing so ignores it and
> segue running as if the value is one, that's the problem
>
> Thank you!
>
>
> 2012/9/16 Serge Fonville 
>
>> Also, if $numero equals 1, it always prints 1.
>> Is that the expected behaviour?
>>
>> When it does not match 1, it does nothing except it echos 1 twice,
>> first in the  conexion.php and second in the first iteration of the
>> while loop
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>>
>>>
>>> 2012/9/16 El Ale... 
>>>
>>> Im sorry "reset;" is not, this is:

 >>> include("conexion.php");

 do {


 echo "$numero";
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?>

 Thanks!


 2012/9/16 Serge Fonville 

> Hi,
>
> if ($numero == 1)
>> reset;
>> continue;
>> break;
>> } while (true);
>
>
> If the $numero is equal to 1 reset seems odd
> reset is a function.and requires an array
> Based on your code, this w

Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
 0) {
 while ($rowEmp = mysql_fetch_assoc($resEmp)) {
$numero = $rowEmp['n'];
}
}
return $numero;
}
?>

in this way?

I do not understand is where the loop would do, what I need to remember is
that if it is "true" to repeat the condition and if false stops.

Thanks!

2012/9/16 Serge Fonville 

> If you wrap the query inside your while loop at the point where you want
>> to check for a change of the value it will change at every iteration.
>
>
> For ease of use, it would be better to create  a function around the data
> gathering part, i.e.
>
>> function updateNumero() {
>>
>> $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'];
>> }
>> }
>>  return $numero;
>> }
>
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 2012/9/16 El Ale... 
>
>> How could I?, should use another command? I need to do that if the value
>> of the script is the same as the database and repeat but stops.
>>
>> greetings!
>>
>>
>> 2012/9/16 Serge Fonville 
>>
>>> Since the value is never changed inside the loop, it will run
>>> indefintely or stop immediately.
>>>
>>> You need to re-request the value from the database to change $numero to
>>> a possible other value.
>>>
>>> Kind regards/met vriendelijke groet,
>>>
>>> Serge Fonville
>>>
>>> http://www.sergefonville.nl
>>>
>>> Convince Microsoft!
>>> They need to add TRUNCATE PARTITION in SQL Server
>>>
>>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>>
>>>
>>>
>>> 2012/9/16 El Ale... 
>>>
 yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle
 break.
 when consulted database and this value is 1, the loop continues, but
 when changing the value of the database for example "value 2", the loop
 should stop because 1 is not equal to 2 but not Doing so ignores it and
 segue running as if the value is one, that's the problem

 Thank you!


 2012/9/16 Serge Fonville 

> Also, if $numero equals 1, it always prints 1.
> Is that the expected behaviour?
>
> When it does not match 1, it does nothing except it echos 1 twice,
> first in the  conexion.php and second in the first iteration of the
> while loop
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 2012/9/16 El Ale... 
>
>>
>>
>> 2012/9/16 El Ale... 
>>
>> Im sorry "reset;" is not, this is:
>>>
>>> >> include("conexion.php");
>>>
>>> do {
>>>
>>>
>>> echo "$numero";
>>> sleep(1);
>>>
>>>
>>> if ($numero == 1)
>>>
>>> continue;
>>> break;
>>> } while (true);
>>>
>>> ?>
>>>
>>> Thanks!
>>>
>>>
>>> 2012/9/16 Serge Fonville 
>>>
 Hi,

 if ($numero == 1)
> reset;
> continue;
> break;
> } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



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

Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Serge Fonville
>
> If you wrap the query inside your while loop at the point where you want
> to check for a change of the value it will change at every iteration.


For ease of use, it would be better to create  a function around the data
gathering part, i.e.

> function updateNumero() {
> $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'];
> }
> }
>  return $numero;
> }


Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



2012/9/16 El Ale... 

> How could I?, should use another command? I need to do that if the value
> of the script is the same as the database and repeat but stops.
>
> greetings!
>
>
> 2012/9/16 Serge Fonville 
>
>> Since the value is never changed inside the loop, it will run indefintely
>> or stop immediately.
>>
>> You need to re-request the value from the database to change $numero to a
>> possible other value.
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>> yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle
>>> break.
>>> when consulted database and this value is 1, the loop continues, but
>>> when changing the value of the database for example "value 2", the loop
>>> should stop because 1 is not equal to 2 but not Doing so ignores it and
>>> segue running as if the value is one, that's the problem
>>>
>>> Thank you!
>>>
>>>
>>> 2012/9/16 Serge Fonville 
>>>
 Also, if $numero equals 1, it always prints 1.
 Is that the expected behaviour?

 When it does not match 1, it does nothing except it echos 1 twice,
 first in the  conexion.php and second in the first iteration of the
 while loop

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 2012/9/16 El Ale... 

>
>
> 2012/9/16 El Ale... 
>
> Im sorry "reset;" is not, this is:
>>
>> > include("conexion.php");
>>
>> do {
>>
>>
>> echo "$numero";
>> sleep(1);
>>
>>
>> if ($numero == 1)
>>
>> continue;
>> break;
>> } while (true);
>>
>> ?>
>>
>> Thanks!
>>
>>
>> 2012/9/16 Serge Fonville 
>>
>>> Hi,
>>>
>>> if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);
>>>
>>>
>>> If the $numero is equal to 1 reset seems odd
>>> reset is a function.and requires an array
>>> Based on your code, this would run indefintely
>>> Since there are no braces after the if statement, only the first
>>> statement is executed when $numero equals 1
>>>
>>> Also, is this your actual code?
>>>
>>> If not and possible please add that
>>>
>>> HTH
>>>
>>> Kind regards/met vriendelijke groet,
>>>
>>> Serge Fonville
>>>
>>> http://www.sergefonville.nl
>>>
>>> Convince Microsoft!
>>> They need to add TRUNCATE PARTITION in SQL Server
>>>
>>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>>
>>>
>>>
>>> 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 

Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
How could I?, should use another command? I need to do that if the value of
the script is the same as the database and repeat but stops.

greetings!

2012/9/16 Serge Fonville 

> Since the value is never changed inside the loop, it will run indefintely
> or stop immediately.
>
> You need to re-request the value from the database to change $numero to a
> possible other value.
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 2012/9/16 El Ale... 
>
>> yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle break.
>> when consulted database and this value is 1, the loop continues, but when
>> changing the value of the database for example "value 2", the loop should
>> stop because 1 is not equal to 2 but not Doing so ignores it and segue
>> running as if the value is one, that's the problem
>>
>> Thank you!
>>
>>
>> 2012/9/16 Serge Fonville 
>>
>>> Also, if $numero equals 1, it always prints 1.
>>> Is that the expected behaviour?
>>>
>>> When it does not match 1, it does nothing except it echos 1 twice, first
>>> in the  conexion.php and second in the first iteration of the while loop
>>>
>>> Kind regards/met vriendelijke groet,
>>>
>>> Serge Fonville
>>>
>>> http://www.sergefonville.nl
>>>
>>> Convince Microsoft!
>>> They need to add TRUNCATE PARTITION in SQL Server
>>>
>>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>>
>>>
>>>
>>> 2012/9/16 El Ale... 
>>>


 2012/9/16 El Ale... 

 Im sorry "reset;" is not, this is:
>
>  include("conexion.php");
>
> do {
>
>
> echo "$numero";
> sleep(1);
>
>
> if ($numero == 1)
>
> continue;
> break;
> } while (true);
>
> ?>
>
> Thanks!
>
>
> 2012/9/16 Serge Fonville 
>
>> Hi,
>>
>> if ($numero == 1)
>>> reset;
>>> continue;
>>> break;
>>> } while (true);
>>
>>
>> If the $numero is equal to 1 reset seems odd
>> reset is a function.and requires an array
>> Based on your code, this would run indefintely
>> Since there are no braces after the if statement, only the first
>> statement is executed when $numero equals 1
>>
>> Also, is this your actual code?
>>
>> If not and possible please add that
>>
>> HTH
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 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
>>>
>>
>>
>

>>>
>>
>


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Serge Fonville
Since the value is never changed inside the loop, it will run indefintely
or stop immediately.

You need to re-request the value from the database to change $numero to a
possible other value.

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



2012/9/16 El Ale... 

> yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle break.
> when consulted database and this value is 1, the loop continues, but when
> changing the value of the database for example "value 2", the loop should
> stop because 1 is not equal to 2 but not Doing so ignores it and segue
> running as if the value is one, that's the problem
>
> Thank you!
>
>
> 2012/9/16 Serge Fonville 
>
>> Also, if $numero equals 1, it always prints 1.
>> Is that the expected behaviour?
>>
>> When it does not match 1, it does nothing except it echos 1 twice, first
>> in the  conexion.php and second in the first iteration of the while loop
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 2012/9/16 El Ale... 
>>
>>>
>>>
>>> 2012/9/16 El Ale... 
>>>
>>> Im sorry "reset;" is not, this is:

 >>> include("conexion.php");

 do {


 echo "$numero";
 sleep(1);


 if ($numero == 1)

 continue;
 break;
 } while (true);

 ?>

 Thanks!


 2012/9/16 Serge Fonville 

> Hi,
>
> if ($numero == 1)
>> reset;
>> continue;
>> break;
>> } while (true);
>
>
> If the $numero is equal to 1 reset seems odd
> reset is a function.and requires an array
> Based on your code, this would run indefintely
> Since there are no braces after the if statement, only the first
> statement is executed when $numero equals 1
>
> Also, is this your actual code?
>
> If not and possible please add that
>
> HTH
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 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
>>
>
>

>>>
>>
>


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
yes it 1 = 1 its (true) bucle's run, but! if 1 is not same  1 bucle break.
when consulted database and this value is 1, the loop continues, but when
changing the value of the database for example "value 2", the loop should
stop because 1 is not equal to 2 but not Doing so ignores it and segue
running as if the value is one, that's the problem

Thank you!

2012/9/16 Serge Fonville 

> Also, if $numero equals 1, it always prints 1.
> Is that the expected behaviour?
>
> When it does not match 1, it does nothing except it echos 1 twice, first
> in the  conexion.php and second in the first iteration of the while loop
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
>
>
> 2012/9/16 El Ale... 
>
>>
>>
>> 2012/9/16 El Ale... 
>>
>> Im sorry "reset;" is not, this is:
>>>
>>> >> include("conexion.php");
>>>
>>> do {
>>>
>>>
>>> echo "$numero";
>>> sleep(1);
>>>
>>>
>>> if ($numero == 1)
>>>
>>> continue;
>>> break;
>>> } while (true);
>>>
>>> ?>
>>>
>>> Thanks!
>>>
>>>
>>> 2012/9/16 Serge Fonville 
>>>
 Hi,

 if ($numero == 1)
> reset;
> continue;
> break;
> } while (true);


 If the $numero is equal to 1 reset seems odd
 reset is a function.and requires an array
 Based on your code, this would run indefintely
 Since there are no braces after the if statement, only the first
 statement is executed when $numero equals 1

 Also, is this your actual code?

 If not and possible please add that

 HTH

 Kind regards/met vriendelijke groet,

 Serge Fonville

 http://www.sergefonville.nl

 Convince Microsoft!
 They need to add TRUNCATE PARTITION in SQL Server

 https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



 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
>


>>>
>>
>


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Serge Fonville
Also, if $numero equals 1, it always prints 1.
Is that the expected behaviour?

When it does not match 1, it does nothing except it echos 1 twice, first in
the  conexion.php and second in the first iteration of the while loop

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



2012/9/16 El Ale... 

>
>
> 2012/9/16 El Ale... 
>
> Im sorry "reset;" is not, this is:
>>
>> > include("conexion.php");
>>
>> do {
>>
>>
>> echo "$numero";
>> sleep(1);
>>
>>
>> if ($numero == 1)
>>
>> continue;
>> break;
>> } while (true);
>>
>> ?>
>>
>> Thanks!
>>
>>
>> 2012/9/16 Serge Fonville 
>>
>>> Hi,
>>>
>>> if ($numero == 1)
 reset;
 continue;
 break;
 } while (true);
>>>
>>>
>>> If the $numero is equal to 1 reset seems odd
>>> reset is a function.and requires an array
>>> Based on your code, this would run indefintely
>>> Since there are no braces after the if statement, only the first
>>> statement is executed when $numero equals 1
>>>
>>> Also, is this your actual code?
>>>
>>> If not and possible please add that
>>>
>>> HTH
>>>
>>> Kind regards/met vriendelijke groet,
>>>
>>> Serge Fonville
>>>
>>> http://www.sergefonville.nl
>>>
>>> Convince Microsoft!
>>> They need to add TRUNCATE PARTITION in SQL Server
>>>
>>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>>
>>>
>>>
>>> 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

>>>
>>>
>>
>


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread El Ale...
2012/9/16 El Ale... 

> Im sorry "reset;" is not, this is:
>
>  include("conexion.php");
>
> do {
>
>
> echo "$numero";
> sleep(1);
>
>
> if ($numero == 1)
>
> continue;
> break;
> } while (true);
>
> ?>
>
> Thanks!
>
>
> 2012/9/16 Serge Fonville 
>
>> Hi,
>>
>> if ($numero == 1)
>>> reset;
>>> continue;
>>> break;
>>> } while (true);
>>
>>
>> If the $numero is equal to 1 reset seems odd
>> reset is a function.and requires an array
>> Based on your code, this would run indefintely
>> Since there are no braces after the if statement, only the first
>> statement is executed when $numero equals 1
>>
>> Also, is this your actual code?
>>
>> If not and possible please add that
>>
>> HTH
>>
>> Kind regards/met vriendelijke groet,
>>
>> Serge Fonville
>>
>> http://www.sergefonville.nl
>>
>> Convince Microsoft!
>> They need to add TRUNCATE PARTITION in SQL Server
>>
>> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>>
>>
>>
>> 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
>>>
>>
>>
>


Re: [PHP] bucle while for to msqyl

2012-09-16 Thread Serge Fonville
Hi,

if ($numero == 1)
> reset;
> continue;
> break;
> } while (true);


If the $numero is equal to 1 reset seems odd
reset is a function.and requires an array
Based on your code, this would run indefintely
Since there are no braces after the if statement, only the first statement
is executed when $numero equals 1

Also, is this your actual code?

If not and possible please add that

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table



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] bucle while for to msqyl

2012-09-16 Thread 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:



3

connect to mysql

conexion.php:

 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