To use PDO is apparently the best way to display data from MySQL database using OOP in PHP
$stmt = $Connection->prepare("SELECT * FROM countries WHERE name = ?");
$stmt->execute(["name_for_search"]);
$data = $stmt->fetchAll();
solved How to display data in MYSQLI using OOP in PHP .