3v4l.org

run code in 300+ PHP versions simultaneously
<?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>

preferences:
33.63 ms | 402 KiB | 5 Q