<?php
foreach($quarter as $_itemKey => $_itemVal){
$sql_year = "SELECT * FROM PL_JOB_PLAN_YEAR WHERE JP_ID = '".$rec_project['JP_ID']."' AND JPY_YEAR = '".$Y_ID."' AND JPY_MONTH = '".$_itemKey."'
AND JPY_NO = '".$a."' ORDER BY JP_ID ASC";
$res_year = $db->query($sql_year);
$rec_year = $db->db_fetch_array($res_year);
$num_itemKey = sprintf("d",$_itemKey);
$JPY_PLAN = ($rec_year['JPY_PLAN'] >0)?number_format($rec_year['JPY_PLAN']):'';
?>
<td style="text-align: center;">
<input type="text" name="JPY_PLAN[<?php echo $a.'_'.$e.'_'.$_itemKey;?>]" id="JPY_PLAN<?php echo $e.'_'.$num_itemKey;?>" class="text-right i-digits span12" onblur="calc_total('<?php echo $e.'_'.$num_itemKey;?>'); shw_plan_m('<?php echo $a.'_'.$e.'_'.$num_itemKey;?>');" value="<?php echo $JPY_PLAN; ?>" class="span12 number_about">
</td>
<?php }?>
มีถ้าต้องการใส่ข้อมูลใหม่ลงในTABLE1 แล้วดึงข้อมูลเก่าจากTABLE1ไปลงTABLE2 เขียนCode PHPได้ยังงัยค่ะ
foreach($quarter as $_itemKey => $_itemVal){
$sql_year = "SELECT * FROM PL_JOB_PLAN_YEAR WHERE JP_ID = '".$rec_project['JP_ID']."' AND JPY_YEAR = '".$Y_ID."' AND JPY_MONTH = '".$_itemKey."'
AND JPY_NO = '".$a."' ORDER BY JP_ID ASC";
$res_year = $db->query($sql_year);
$rec_year = $db->db_fetch_array($res_year);
$num_itemKey = sprintf("d",$_itemKey);
$JPY_PLAN = ($rec_year['JPY_PLAN'] >0)?number_format($rec_year['JPY_PLAN']):'';
?>
<td style="text-align: center;">
<input type="text" name="JPY_PLAN[<?php echo $a.'_'.$e.'_'.$_itemKey;?>]" id="JPY_PLAN<?php echo $e.'_'.$num_itemKey;?>" class="text-right i-digits span12" onblur="calc_total('<?php echo $e.'_'.$num_itemKey;?>'); shw_plan_m('<?php echo $a.'_'.$e.'_'.$num_itemKey;?>');" value="<?php echo $JPY_PLAN; ?>" class="span12 number_about">
</td>
<?php }?>