php sql data pdo fetch into table code example
Example 1: php pdo fetch from db
$pdo = new PDO('mysql:host=$host; dbname=$database;', $user, $pass);
$stmt = $pdo->prepare('SELECT * FROM auction WHERE name = :name');
$stmt->bindParam(':name', $_GET['searchdivebay']);
$stmt->execute(array(':name' => $name);
Example 2: how to fetch data using pdo in php
$stmt = $pdo->prepare("SELECT * FROM users LIMIT :limit, :offset");$stmt->execute(['limit' => $limit, 'offset' => $offset]); $data = $stmt->fetchAll();