<?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)) {
$x = 0;
while ($x <= $i) {
$x++;
echo "<input type='checkbox'" . ($a1['nomer'] == $x ? " disabled='disabled'" : "") . "name='stolik[]' value='{$x}'>{$x}";
}
}
?>