with below code trying update table using post values. after updating, same variables trying insert values table if condition. first update working properly, insert not happening.
<?php if (isset($_post['submit'])) { $wlnid=$_post['wlt_ln_id']; $refwal = $_post['wlt_name']; $refamt = $_post['wlt_ln_refund_amt']; $refdtls = $_post['wlt_ln_txn_details']; $refdate = $_post['wlt_ln_refund_date']; $lntype = $_post['wlt_ln_type']; $query=mysqli_query($globals["___mysqli_ston"], "update wallet_loans set wlt_ln_refund_acct = '$refwal',wlt_ln_refund_amt=wlt_ln_refund_amt+'$refamt',wlt_ln_refund_txn_details='$refdtls',wlt_ln_refund_date='$refdate' wlt_ln_id = '$wlnid'and wlt_holder_id = '{$_session['sess_member_id']}'"); if($lntype == 'given'){ $sql = "insert wallet_txns(wlt_name, wlt_txn_date, wlt_txn_type, wlt_drcr_cod, wlt_txn_amount, wlt_txn_dtls, wlt_txn_cat, wlt_txn_cat_sub, wlt_amt_payee, wlt_holder_id, wlt_txn_flg_loan, wlt_txn_ln_id, wlt_txn_flg_recr, wlt_txn_recr_id) values ( '$refwal', '$refdate', 'income','c', '$refamt', '$refdtls', 'loan refund','null','null', '{$_session['sess_member_id']}', 'y','$wlnid', 'n',0)"; } else if($lntype == 'received'){ $sql = "insert wallet_txns(wlt_name, wlt_txn_date, wlt_txn_type, wlt_drcr_cod, wlt_txn_amount, wlt_txn_dtls, wlt_txn_cat, wlt_txn_cat_sub, wlt_amt_payee, wlt_holder_id, wlt_txn_flg_loan, wlt_txn_ln_id, wlt_txn_flg_recr, wlt_txn_recr_id) values ( '$refwal', '$refdate', 'expense','d', '$refamt', '$refdtls', 'loan refund','null','null', '{$_session['sess_member_id']}', 'y','$wlnid', 'n',0)"; } }?> advance supports.
in code, never calling mysqli_query sql query.
if ($lntype == 'given') { $sql = "insert wallet_txns(wlt_name, wlt_txn_date, wlt_txn_type, wlt_drcr_cod, wlt_txn_amount, wlt_txn_dtls, wlt_txn_cat, wlt_txn_cat_sub, wlt_amt_payee, wlt_holder_id, wlt_txn_flg_loan, wlt_txn_ln_id, wlt_txn_flg_recr, wlt_txn_recr_id) values ( '$refwal', '$refdate', 'income','c', '$refamt', '$refdtls', 'loan refund','null','null', '{$_session['sess_member_id']}', 'y','$wlnid', 'n',0)"; mysqli_query($globals["___mysqli_ston"], $sql); } else if($lntype == 'received'){ $sql = "insert wallet_txns(wlt_name, wlt_txn_date, wlt_txn_type, wlt_drcr_cod, wlt_txn_amount, wlt_txn_dtls, wlt_txn_cat, wlt_txn_cat_sub, wlt_amt_payee, wlt_holder_id, wlt_txn_flg_loan, wlt_txn_ln_id, wlt_txn_flg_recr, wlt_txn_recr_id) values ( '$refwal', '$refdate', 'expense','d', '$refamt', '$refdtls', 'loan refund','null','null', '{$_session['sess_member_id']}', 'y','$wlnid', 'n',0)"; mysqli_query($globals["___mysqli_ston"], $sql); }
Comments
Post a Comment