PHP Classes

File: Example.SelectMultipleRows.php

Recommend this page to a friend!
  Classes of Dustin Ruckman   DB Access using PDO   Example.SelectMultipleRows.php   Download  
File: Example.SelectMultipleRows.php
Role: Example script
Content type: text/plain
Description: Use the class to select multiple rows and cycle them.
Class: DB Access using PDO
Query MySQL tables with prepared queries using PDO
Author: By
Last change: My variable names were wrong.
Date: 9 years ago
Size: 472 bytes
 

Contents

Class file image Download
<?php

require('path/to/DatabaseAccess.Class.php');

$DbAccess = new DatabaseAccess("yourHost", "dbName", "dbUser", "dbUserPassword");

$DbAccess->PrepareStatement("SELECT * FROM `UserAccounts`");
$userDatas = $DbAccess->ExecuteQuery_Get();

// We can test that something was returned, but since we are doing
// a foreach on the results it's really not needed
if (count($userData) < 1)
    return;

foreach (
$userDatas as $userData)
{
   
var_dump($userData);
}