<?php
    session_start();
    include 'config.php';
    $uid = $_SESSION['userid'];
    $uname = $_SESSION['uname'];
    $regime_type = $_SESSION['regime_type'];
    $cargo_channel = $_SESSION['cargo_channel'];   
    $searchTerm = $_GET['term'];
    $country = $_GET['country'];
    //get matched data from countries table
    $sql_stmt = "SELECT * FROM port_master where description LIKE '%$searchTerm%' or code like '%$searchTerm%' having country = '$country'";

    $result = mysqli_query($con,$sql_stmt);
    while($row = mysqli_fetch_array($result))
    {
        $data1[] .= $row['description'].'-'.$row['code'];
    }
    echo json_encode($data1);
?>