<?php
    include '_connect.php';

    $ct_no = $_GET['ct_no'];
    $billerid = $_GET['billerid'];
    $ref1 = $_GET['ref1'];
    $ref2 = $_GET['ref2'];
    $price = $_GET['price'];
    $QRCODE = $billerid." ".$ref1." ".$ref2." ".$price."00";
    // $ct_no = "2511630060";

    // $cnsvbarcode = $_GET['cnsvbarcode'];
    // $cnsvrefcode = $_GET['cnsvrefcode'];
    // $cnsvrefno = $_GET['cnsvrefno'];

    $sql = "SELECT ps_name,ct_mobileno,product_name,ct_no FROM EHONGDB.dbo.hps_ctmain
    WHERE ct_no = '$ct_no'";
    $select=$dbh->prepare($sql);
    $select->execute();
    $fetchx=$select->fetch();
    $ps_name = $fetchx['ps_name'];
    $ct_mobileno = $fetchx['ct_mobileno'];
    $product_name = $fetchx['product_name'];

    $sql_array[] = array(
        "ct_no" => $ct_no,
        "ps_name" => $ps_name,
        "ct_mobileno" => $ct_mobileno,
        "product_name" => $product_name,
        "price" => $price,
        "price_2" => number_format($price,2),
        "billerid" => $billerid,
        "ref1" => $ref1,
        "ref2" => $ref2,
        "QRCODE" => $QRCODE
        );
    
    echo json_encode($sql_array);
?>