U
U
Uzair Izha2015-10-29 21:14:54
PHP
Uzair Izha, 2015-10-29 21:14:54

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

3 answer(s)
I
inDeepCode, 2015-10-29
@inDeepCode

If you issue the code, then the answer will be found by itself.

S
Stalker_RED, 2015-10-29
@Stalker_RED

$x and $atb are not defined.

S
Sergey Okhonko, 2015-10-29
@sersergei

while ($x<=$atb) Look at the condition of what you are comparing with

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question