<?php

$servername = 'localhost';
$username   = 'root';
$password   = '';
$dbName     = 'sb123';

try {

    $db = new PDO(
        "mysql:host=$servername;dbname=$dbName;charset=utf8mb4",
        $username,
        $password
    );

    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch(PDOException $e){

    die("DB ERROR");

}

$id     = $_POST['id'] ?? 0;
$status = $_POST['status'] ?? '';

$allowed = ['pending', 'approved', 'rejected'];

if(!in_array($status, $allowed)){

    die("INVALID STATUS");

}

$sql = "UPDATE info SET status = :status WHERE id = :id";

$stmt = $db->prepare($sql);

$stmt->execute([

    ':status' => $status,
    ':id'     => $id

]);

echo "success";