$res = mysql_query($sql); $row = mysql_fetch_array($res); print "<tr>"; print "<td style='width:150px;'>"; print $row['name']; print "</td>"; for ($j = 0; $j < count($ColorID); $j++) { $sql = "select id,num from `{$now_table}` where cid='" . $ColorID[$j] . "' and sid='" . $SizeID[$i] . "' and `pid`='{$pid}'"; $res = mysql_query($sql); $num = mysql_num_rows($res); if ($num == 0) { $unit->cid = $ColorID[$j]; $unit->sid = $SizeID[$i]; $unit->pid = $pid; $unit->add(); $row = $unit->display(); } else { $row = mysql_fetch_array($res); } $id = $row['id']; $num = $row['num']; if (empty($num)) { $num = 0; } //顯示0 print "<td>"; print "<input type='text' name='p_numbers' value='{$num}' onBlur='stock_upd({$id},\$(this).val())' "; if ($num > 0) { print "style='width:25px;color:blue;'> "; } else { print "style='width:25px;color:red;'> ";