Add a text before getting the data from database codeigniter

I just want to ask if how can I add a text before getting the data from database . My code looks like this

$GTextension = 'GT-';
    $UTextension = 'UT-';
    $rec_type = array(1472,1416,9752,1417,1500);//international,manila,province
    $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 = $last_receipt->row()-> $UTextension. inv_cno+1;
        }

so is it possible to add a text before the data . Here's what i need to add the text

elseif($receipt == 4){
            $newreceipt = $last_receipt->row()-> $UTextension. inv_cno+1;
        }

so it would look like this

DR: UT-0001;

1 answer

  • answered 2018-11-08 06:46 MyNameIs

    first check @MagnusEriksson comment.

    then try to add this

    elseif($receipt == 4){
                $newreceipt = ++$last_receipt->row()->inv_cno;
                $newreceipt = $UTextension.$newreceipt;
     }
    

    if there is an error please put in comment