pdo connection php
<?php
$db = "mysql:host=localhost;dbname=pdolearn";
$user = "root";
$password = "";
$pdo = new PDO($db, $user, $password);
// $stmt = "SELECT * FROM countries"; //for mySQL
$stmt = $pdo->query("SELECT * from countries");
// while($row = mysqli_fetch_assoc($stmt)) //for mysql
while ($row = $stmt->fetch())
{
echo "<pre>";
print_r($row);
}