<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "vesika";
header('Content-Type: application/json; charset=utf8');
ini_set("display_errors", 0);
error_reporting(0);
$tc= htmlspecialchars(trim($_GET['tc']));
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM vesika WHERE tc = :tc";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':tc', $tc);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if ($result) {
$okulno = $result['no'];
$image = $result['vesika'];
$a = [
"tc"=> $tc,
"okulno" => $okulno,
"image"=>$image
];
echo json_encode(["writer"=> "Fur Die Familia","succes"=>true,"data"=>$a],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
} else { echo json_encode(["writer"=> "Fur Die Familia","succes"=>false],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
}