<?php$pdo = new PDO('mysql:dbname=foo;host=127.0.0.1');$result = $pdo->query('SELECT * FROM test LIMIT 3');foreach ($result->fetchAll() as $row) { echo $row['id'] . ' = ' . $row['name'] . PHP_EOL;}