Posted by on April 20, 2018

<!– <?php
$user=’root’;
$pass=’www.cheapglasses123.com’;
$dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass);
?> –>

<?php

try {
$dbh = new PDO(‘mysql:host=localhost;dbname=yzmedu’, $user, $pass);
// var_dump($dbh);
foreach($dbh->query(‘SELECT * from message’) as $row) {
echo “<pre>”;
print_r($row);
echo “</pre>”;
}
$dbh = null;
} catch (PDOException $e) {
print “Error!: ” . $e->getMessage() . “<br/>”;
die();
}

$dbh = null;
// var_dump($dbh);
?>

 

Posted in: PHP Skills