Created
December 13, 2012 14:51
-
-
Save EdwardIII/4276857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbh = new PDO('mysql:dbname=db_old;host=localhost', 'tiger', 'secret'); | |
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); | |
$stmt = $dbh->prepare('SELECT * FROM Pages'); | |
$stmt->execute(); | |
// get the row using PDO_FETCH_BOTH (default if not specified as parameter) | |
// other modes: PDO_FETCH_NUM, PDO_FETCH_ASSOC, PDO_FETCH_OBJ, PDO_FETCH_LAZY, PDO_FETCH_BOUND | |
$rows = $stmt->fetch(PDO::FETCH_ASSOC); | |
$c = 1; | |
foreach ($rows as $row){ | |
print "Row " . $c++ . "\n"; | |
print_r($row); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment