$pr=$pdo->prepare("INSERT INTO nonce(id_nonce, created_at) VALUES(DEFAULT, :tnow);");
if($pr!==false){
$ok=$pr->execute([":tnow"=>time()]);
if(!$ok){
printf("* cannot insert data\n\n");
}
}else{
printf("* cannot insert data\n\n");
}
// 3. select all
$st=$pdo->query("SELECT * FROM nonce ORDER BY id_nonce DESC LIMIT 100;");
if($st!==false){
$nonces=$st->fetchAll();
printf("<pre>\n");
$max=count($nonces);
foreach($noncesas$key=>$value){
if($key==0){
printf("<span class='yay'>YOU ARE EXACTLY THE <strong>%d</strong>th VISITOR, CLICK <a href=''>HERE</a> TO WIN THE PRIZE !!</span>\n",$value['id_nonce']);
printf("\nWow ! Got lucky\n\n");
continue;
}
printf("<span class='faded'>%s</span> | You are the <strong>%d</strong>th visitor, click <a href=''>here</a> to win the prize !!\n",date('H:i:s d/m/Y',$value['created_at']),$value['id_nonce']);