This is an old revision of the document!
<?php
error_reporting(-1);
ini_set('display_errors', 1);
$host = "localhost";
$username = "coding_user";
$password = "cheese";
$db_name = "coding";
$mysql_string = "mysql:host=$host;dbname=$db_name";
$db_connection = new PDO($mysql_string, $username, $password);
$sql = "select * from test_table order by surname desc";
$rs = $db_connection->query($sql);
$rows = $rs->fetchAll(PDO::FETCH_ASSOC);
echo "<ol>";
foreach($rows as $row) {
echo "<li>";
echo $row['surname'].", ".$row['forename'];
echo " (".date("D jS M Y", strtotime($row['date_added']));
echo ")";
echo "</li>";
}
echo "</ol>";
?>