Skip to content

Instantly share code, notes, and snippets.

@Drarok
Forked from anonymous/gist:8218272
Last active January 2, 2016 01:28
Show Gist options
  • Save Drarok/8230064 to your computer and use it in GitHub Desktop.
Save Drarok/8230064 to your computer and use it in GitHub Desktop.
Converted example to use PDO.
<?php
$dsn = 'mysql:host=trolololol;dbname=WOOT!';
$username = 'yeah';
$password = 'MMMMM hmm';
$pdo = new PDO($dsn, $username, $password);
$sql = 'SELECT `date`, SUM(`Commited`) AS committedSum FROM StorageUsedByVm GROUP BY `date`';
$stmt = $pdo->query($sql);
$data = $stmt->fetchAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment