0

逻辑:我在下拉菜单中有这个范围选项。它有 1-12 的数字,代表客户将支付的月数。当我选择“1”时,没有问题,因为我只会保存一个日期。但是如果我选择“2”,我应该可以保存两次相同的数据,并且日期将是连续的,所以一键可以创建2条记录。(例如:2013 年 9 月 9 日和 13 年 10 月 9 日)三个及以上也是如此。有人能帮我吗?这是在代码点火器中。谢谢。

模型:

  function add_payment($id, $keyid, $key, $paymentdate, $forpaymentdate, $datecreated, $subscription_type){
    $this->db->set('keyid', $keyid);
    $this->db->set('key',$key);
    $this->db->set('paymentdate',$paymentdate);
    $this->db->set('forpaymentdate',$forpaymentdate);
    $this->db->set('userid','0');
    $this->db->set('notified','0');
    $this->db->set('subscription_type', $subscription_type);
    $this->db->insert('payment');
}

控制器:

function save_payment(){
    $id = @$_POST['id'];
$keyid = @$_POST['keyid'];
$key = @$_POST['key'];
$dateofpayment = @$_POST['dateofpayment'];
$forpaymentdate = @$_POST['forpaymentdate'];
$datecreated = @$_POST['datecreated'];
$subscription_type = @$_POST['subscription_type'];
//$userid = $_POST['userid'];
//$notified = $_POST['notified'];

$this->operation->add_payment($id, $keyid, $key, $dateofpayment, $forpaymentdate, $datecreated, $subscription_type);
    die(redirect(base_url('system/payment?status=saved')));

    }
4

0 回答 0