Here's my code
    $receipt = $_POST['receipt'];
    $invid = $_POST['invid'];
    // $receipt = intval($receipt);
    // $invid = intval($invid);
    $newreceipt = 0;
    $GTextension = 'GT-';
    $UTextension = 'UT-';
    $rec_type = array(1472,1416,9752,1417,1500);
    $last_receipt = $this->ion_auth->getLastReceipt($receipt);
    if($last_receipt->num_rows() > 0){
        if($receipt == 1){
            $newreceipt = $last_receipt->row()->inv_cno+1;
        }
        elseif($receipt == 2){
            $newreceipt = $last_receipt->row()->inv_cno+1;
        }
        elseif($receipt == 3){
            $newreceipt = $last_receipt->row()->inv_cno+1;
        }
        elseif($receipt == 4){
            $newreceipt = $UTextension.(++$last_receipt->row()->inv_cno);
        }
        else if($receipt == 5){
            $newreceipt = $GTextension.(++$last_receipt->row()->inv_cno);
        }
    }
    $this->ion_auth->update_receipt($invid,$receipt,$newreceipt);
    $return = array('dr_no' => $newreceipt);
    echo json_encode($return);
Now the output of this code is like this
if i choose ==4 then it it is like this
UT-1418 it's correct.
then if i choose again ==4 the problem exist because it is now like this
UT-UT-1419. It's incrementing also the extension. All i want to increment is the data which is -1419
Can someone help me please. Thank you.
