<?php
 
include 'dataconfig.php' ;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$app_id = urldecode($_POST['appId']);

$sql = "SELECT * FROM `notifications` WHERE `app_id` LIKE $app_id ORDER BY id DESC";

$result = $conn->query($sql);

mysqli_query($conn,$sql); 

$response = array();

while($row = mysqli_fetch_array($result)){
    array_push($response,array(
        'id'=>$row['id'],
        'type'=>$row['type'],
        'message'=>$row['message'],
        'date'=>$row['date'],
        'status'=>$row['status'],
        'thumb'=>$row['thumb'],
        'thumb_type'=>$row['thumb_type']
    ));
}
echo json_encode(array('result'=>$response));
$conn->close();
?>