|
@@ -5,7 +5,7 @@
|
|
|
|
|
|
// Database connection
|
|
|
// http://www.php.net/manual/en/ref.pdo-mysql.php
|
|
|
-$pdo = new PDO('mysql:host=localhost;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
|
|
|
+$pdo = new PDO('mysql:host=localhost;dbname=hello_world;charset=utf8', 'benchmarkdbuser', 'benchmarkdbpass', array(
|
|
|
PDO::ATTR_PERSISTENT => true
|
|
|
));
|
|
|
|
|
@@ -14,7 +14,7 @@ $statement = $pdo->prepare('SELECT * FROM Fortune');
|
|
|
$statement->execute();
|
|
|
|
|
|
// Store result in array.
|
|
|
-$arr = $statment->fetchAll();
|
|
|
+$arr = $statement->fetchAll();
|
|
|
$arr[] = array('id' => 0, 'message' => 'Additional fortune added at request time.');
|
|
|
|
|
|
function cmp($a, $b) {
|
|
@@ -42,10 +42,10 @@ uasort($arr, 'cmp');
|
|
|
foreach ($arr as &$value) {
|
|
|
?>
|
|
|
<tr>
|
|
|
-<td><?php echo return htmlspecialchars($value['id'], 'ENT_COMPAT | ENT_HTML401', 'UTF-8'); ?></td>
|
|
|
-<td><?php echo return htmlspecialchars($value['message'], 'ENT_COMPAT | ENT_HTML401', 'UTF-8'); ?></td>
|
|
|
+<td><?php echo htmlspecialchars($value['id'], ENT_QUOTES, 'UTF-8'); ?></td>
|
|
|
+<td><?php echo htmlspecialchars($value['message'], ENT_QUOTES, 'UTF-8'); ?></td>
|
|
|
</tr>
|
|
|
<?php } ?>
|
|
|
</table>
|
|
|
</body>
|
|
|
-</html>
|
|
|
+</html>
|