$invoice_id = $data['invoice_id'];
$remark = ' ### Manually set as Paid Note: '.$data['paid_note'].' ###';
$sql = "UPDATE tbl_invoice SET payment_status = 1, remark = remark+'$remark' WHERE invoice_id = $invoice_id";
This should append 'remark' field with new value. but remark field is updated with '0'. Strange! Can't find out whats problem is going on my code. Any idea?
NB: I am using MySql DBMS.
You should learn to use parameters. But your issue is using +
, which is addition. I presume you want string concatenation:
UPDATE tbl_invoice
SET payment_status = 1,
remark = CONCAT(remark, '$remark')
WHERE invoice_id = $invoice_id;
However, the code should look more like this:
UPDATE tbl_invoice
SET payment_status = 1,
remark = CONCAT(remark, ?)
WHERE invoice_id = ?;
where ?
is a placeholder for the parameters.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.