【发布时间】:2018-05-15 21:53:00
【问题描述】:
我有一个用 php CodeIgniter 编写的小型计费软件。这就是我在提交付款时保存价值的方式
<?php
public function addPayment() {
$id = $this->input->post('id');
$client_id = $this->input->post('client_id');
$date = strtotime($this->input->post('date_from_addpayment'));
$description = $this->input->post('description');
$cash_pending = $this->input->post('cash_pending');
$cash_recevied = $this->input->post('cash_recevied');
$balance = $cash_pending - $cash_recevied;
?>
当每笔交易发生时,我想将当时客户的所有到期款项相加,并将其保存在 MySQL 的余额表中。 我的PHPMySQL支付栏结构如下:
https://i.stack.imgur.com/ELJrL.png
我只想当用户添加付款时,然后在此列中显示当时到期的余额。
【问题讨论】:
-
我看到你在做
$due = $cash_pending - $cash_received,但语句末尾没有分号。其次,你$due = $cash_pending - $cash_received的结果是什么? -
@YashKaranke 先生,如果我在 cash_pending 中放入 1000,在 cash_received 中放入 500,则 $due = 500。
-
您的代码工作正常吗?
$due的输出是什么? -
因此您想将当前到期金额(上面的代码)添加到数据库中存储的到期金额中;而且我猜还要更改数据库中的现金待处理和收到的现金字段?
标签: php codeigniter billing