Last active
August 29, 2015 14:06
-
-
Save mitsuru/3e2219f6d0eb3b041c10 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
try { | |
// $pdo は接続オブジェクト | |
$pdo = new PDO("mysql:host=localhost; dbname=pdotest", | |
"root", "pass"); | |
$stmt = $pdo->query("SELECT * FROM CD"); | |
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ | |
echo implode(", ", $row) . PHP_EOL; | |
} | |
} catch (PDOException $e){ | |
var_dump($e->getMessage()); | |
} | |
$pdo = null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment