<?php
$host='localhost';
$user='post';
$password='AMRdahes03250@';
$dbname='post';
$conn = new mysqli($host, $user, $password, $dbname);
$conn->set_charset("utf8");
 
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "select * from post";
$response= array(); 

$stmt = $conn->prepare($sql);
$stmt->execute();

$stmt->bind_result($id, $body ,$title ,$linke,$image);
 
while($stmt->fetch()){
 
 $post = [
  'id'=>$id,
 'body'=>$body,
 'title'=>$title,
 'linke'=>$linke,
 'image'=>$image,

 
 ];
 
 array_push($response, $post);
}

echo json_encode(array("post"=>$response),JSON_UNESCAPED_UNICODE);


?>