PHP Classes

File: Example.SelectMultipleRows.Simple.php

Recommend this page to a friend!
  Classes of Dustin Ruckman   DB Access using PDO   Example.SelectMultipleRows.Simple.php   Download  
File: Example.SelectMultipleRows.Simple.php
Role: Example script
Content type: text/plain
Description: Same as SelectMulitpleRows example but uses the single method call.
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: 435 bytes
 

Contents

Class file image Download
<?php

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

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

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

// 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);
}