- ini_set: documentation ( source)
- error_reporting: documentation ( source)
- shuffle: documentation ( source)
- session_start: documentation ( source)
- range: documentation ( source)
<?php
// Set these right at the top!
ini_set('display_errors', 'On');
error_reporting(-1);
session_start();
include '../connect.php';
$_SESSION['db'] = 'concorso'; //name of database
$_SESSION['quiz']='simulazione'; //name of table
$_SESSION['quiz_id'] = 2;
//generates casual numbers
$sql = "SELECT COUNT(*) FROM {$_SESSION['quiz']}";
$stmt = $dbh->prepare($sql);
$stmt->execute();
$rows = $stmt->fetch(PDO::FETCH_NUM); //Number of rows in table
$_SESSION['numbers'] = range(1, $rows[0]);
shuffle($_SESSION['numbers']);
echo $rows[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test Page</title>
</head>
<body>
</body>
</html>