[php]
<html>
<head><title>PHP TEST</title></head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body>
<?php
try {
$db = new PDO('sqlite:test.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die ('Connection failed : '.$e->getMessage());
}
try {
$sql = 'select * from data order by SCORE DESC;';
$stmt = $db->query($sql);
while($result = $stmt->fetch(PDO::FETCH_ASSOC)){
print($result['SCORE'] .',' );
print($result['UDID'].',');
print($result['NAME'].'<br>');
}
} catch (PDOException $e) {
$err = $db->errorInfo();
die ($err[2]);
}
unset($db);
?>
</body>
</html>
[/php]