while ($row=db_fetch($res))
{
$w[]=$row[0];
}
while (list ($num, $name) = each ($dow))
{
$checked="";
if (in_array ($num, $w)) $checked="checked";
echo "<tr>\n";
echo "<td>$name</td><td><input type=checkbox name=$num $checked></td>\n";
echo "</tr>\n";
}