我正在尝试使用多个while循环编辑复选框值,但我得到重复的值。如何阻止这种重复?这是代码:
<tr>
<?php
$qqqq = mysql_query("select * from tbl_color ");
while($rr = mysql_fetch_array($qqqq)) {
$dara = $rr['color'];
$ids = $rr['id'];
$datas = mysql_query("select * from ifix_model_tbl where id='".$g_select_id."'");
while($rw = mysql_fetch_array($datas)) {
$fg = $rw['color'];
$ecolor = unserialize($fg);
foreach($ecolor as $ucolor) {
echo $ucolor = $ucolor['id'];
?>
<td width="130">
<input style="padding-top:100px" name="colo[]" type="checkbox" value="<?php echo $ids?>"
<?php if($ucolor == $ids){ echo 'checked="checked"'; } ?>
/ >
<?php echo $dara;?>
</td>
<?php
}
}
}
?>
</tr>
现在我得到这样的结果:
我需要这样的结果: