我的代碼有什麼問題?由於$is_add
,行不會顯示。但是,當我將其更改爲$tot_shrs_amt
行顯示和is_add的值爲1字段is_add(tinyint(1)),行不會顯示
case "Compute":
$is_add = $tot_shrs_amt.$bnfts.$dvdnd.$loan.$grcery.$life_insrnce.$funeral_pln.$flu_vccne.$eye_glss;
$tot_shrs_amt = $_POST['total_shares_amount'];
$bnfts = $_POST['benefits'];
$dvdnd = $_POST['dividend'];
$coop_shrs = $_POST['coop_shares'];
$loan = $_POST['loan'];
$grcery = $_POST['grocery'];
$life_insrnce = $_POST['life_insurance'];
$funeral_pln = $_POST['funeral_plan'];
$flu_vccne = $_POST['flu_vaccine'];
$eye_glss = $_POST['eye_glass'];
$tot_ddctns = $_POST['total_deductions'];
if($tot_shrs_amt){
$tot_shrs_amt = 1;
}
if($bnfts){
$bnfts = 1;
}
if($dvdnd){
$dvdnd = 1;
}
if($coop_shrs){
$coop_shrs = 1;
}
if($loan){
$loan = 0;
}
if($grcery){
$grcery = 0;
}
if($life_insrnce){
$life_insrnce = 0;
}
if($funeral_pln){
$funeral_pln = 0;
}
if($flu_vccne){
$flu_vccne = 0;
}
if($eye_glss){
$eye_glss = 0;
}
if($tot_ddctns){
$tot_ddctns = 0;
}
$coopmemID = $_POST['coopmemID'];
$emp_no = trim($_POST['emp_no']);
$coop_shares = $_POST['total_share'];
$total_deductions = $_POST['total_deductions'];
$net_amount = $_POST['net_amount'];
$date_resigned = $_POST['date_resigned'];
$rep1 = str_replace(",", "", $coop_shares);
$rep2 = str_replace(",", "", $total_deductions);
$rep3 = str_replace(",", "", $net_amount);
$sql = "INSERT INTO tb_finalpay (coopmemID, emp_no, total_share, total_deduct, net_amount, date_released, date_resigned) VALUES ('$coopmemID','$emp_no','$rep1','$rep2','$rep3','".date('Y-m-d')."', '$date_resigned')";
$result = $atecCoop->query($sql);
$insert = $atecCoop->insert_id;
$sql2 = "SELECT
p.fpayID, m.cooploanID, YEAR(p.date_resigned) as date_resigned
FROM
tb_cooploan_master as m
INNER JOIN
tb_finalpay as p
ON
m.coopmemID = p.coopmemID
WHERE
clmstID!='NULL' AND p.coopmemID='$coopmemID'";
$result = $atecCoop->query($sql2);
while ($row = $result->fetch_object()){
$cooploanID = $row->cooploanID;
$fpayID = $row->fpayID;
$date_resigned = $row->date_resigned;
$sql3 = "INSERT INTO tb_finalpay_detail (fpayID, cooploanID, syear, is_add) VALUES ($fpayID, $cooploanID, $date_resigned, $is_add)";
$atecCoop->query($sql3);
}
break;
我覺得這裏的問題。
$is_add = $tot_shrs_amt.$bnfts.$dvdnd.$loan.$grcery.$life_insrnce.$funeral_pln.$flu_vccne.$eye_glss;
你有元音短缺你不;) –
是的。我做到了獨一無二。 aeiou :) – Micaela
是'$ is_add = $ tot_shrs_amt。$ bnfts。$ dvdnd。$ loan。$ grcery。$ life_insrnce。$ funeral_pln。$ flu_vccne。$ eye_glss; '這等於1? – Saty