<?php

include "config.php";

$return_arr = array();

$query = "SELECT * FROM tb_webhelpsearch";

$result = mysqli_query($con,$query);

while($row = mysqli_fetch_array($result)){
    $id = $row['id'];
    $username = $row['datetime'];
    $name = $row['url'];
    $email = $row['searchtext'];

    $return_arr[] = array("id" => $id,
                    "datetime" => $datetime,
                    "url" => $url,
                    "searchtext" => $searchtext);
}

// Encoding array in JSON format
echo json_encode($return_arr);