Amit Dhamu

Software Engineer

Simple Select Query with PDO

$connection = new PDO("mysql:host=localhost;dbname=database1", $username, $pass);

$select_books = $connection->query('SELECT * FROM books');

// Num of records

// Associate array of all results

// To loop through the results
while ($books = $select_books->fetch()) {
    echo $books['title'] . '<br>';

 mysql / query / select / pdo

Query Fetch Types in PDORemove Empty Lines In SublimeText

Show Comments

Made with by Amit Dhamu.
© MMXX. All rights reserved.