<?php
$con = new PDO('mysql:host=localhost;dbname=yourdb', 'root', '');
$stmt = $con->prepare('select * from product');
$stmt->execute();
while ($product = $stmt->fetch(PDO::FETCH_OBJ)) {
echo 'id: ' . $product->id . '<br>';
echo 'name: ' . $product->name . '<br>';
echo 'price: ' . $product->price . '<br>';
echo '-------------------<br>';
}
?>