Answer the question
In order to leave comments, you need to log in
How to make two while loops not interfere with each other?
I have two cycles, one inside the other. So because of the fact that this is so, what I deduce from the database does not work correctly in the second cycle.
$rf= mysql_query("SELECT * FROM `zRestoran` WHERE idrest='$id' and data='$data' and time='$time'");
while ($a= mysql_fetch_assoc($rf)){
$vak = $a['nomer']; echo $vak;
while ($x<=$atb) { $x++; ?>
<div class="nomer_stola" <?php if($vak==$x){ ?> style="background-color: red;" <?php } ?>><label>
<input type="checkbox" <?php if($vak==$x){?> disabled="disabled" <?php } ?> name="stolik[]" value="<?php echo $x; ?>,"><?php echo $x; ?></label></div>
<?php } } ?>
Answer the question
In order to leave comments, you need to log in
while ($x<=$atb) Look at the condition of what you are comparing with
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question