<?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'];

    //get matched data from countries table
    $sql_stmt = "SELECT * FROM port_master
                    where code LIKE '%$searchTerm%' 
                or description LIKE '%$searchTerm%' 
                    or country  LIKE '%$searchTerm%'";
    // var_dump($sql_stmt);die;
    $result = mysqli_query($con,$sql_stmt);
    while ($row = $result->fetch_assoc()) 
    {
        $data1[] = $row['description'];
        // $data2[] = $row['description'];
    }

    //return json data
    echo json_encode($data1);
?>