U
U
Uzair Izha2015-10-30 02:56:19
PHP
Uzair Izha, 2015-10-30 02:56:19

Why does one while loop interfere with another?

Because of the second loop, the $a1['nomer'] variable does not iterate over the values ​​it has, but simply output the first value (inside the second loop), because of this, I cannot check the input. How to be?
If you do echo $a1['nomer'] in the first loop, three values ​​are displayed. If the same thing is displayed in the second cycle, the first value, then there is one.

<?php
 $x=0; $i = 24;
 $rf= mysql_query("SELECT * FROM `zRestoran` WHERE idrest='$id' and data='$data' and time='$time'");
while ($a1= mysql_fetch_assoc($rf)){ 
while ($x<=$i )   {    $x++;  ?>
<input type="checkbox" <? if($a1['nomer']==$x){?> disabled="disabled" <? } ?> name="stolik[]" value="<? echo $x; ?>"><? echo $x; ?>
<?php }} ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene_Sh, 2015-10-30
@Eugene_Sh

Where is the definition of $resv['stol']? What is it anyway? The second cycle is endless.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question