is there any better way than this? sure it is but i dont know how.
Im trying to distribute some numbers from my database to each user(host) visiting my page. one number
(item) per visit.
all i came up with is some primitive way. im asking if there is any faster or shorter way than this?
keep in mind that i dont want to use cockies or register the user. the numbers are saved as a string in a column only.
<?php
include_once 'includes/conn.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>VeniVidiVici</title>
</head>
<body>
<?php
$query = "SELECT numero FROM potluck LIMIT 1;";
$result = mysqli_query($conn, $query);
$resultCheck = mysqli_num_rows($result);
echo $resultCheck ."<br>";
if ($resultCheck > 0){
$row= mysqli_fetch_row($result);
echo $row['0'];
$del = "DELETE FROM potluck LIMIT 1;";
mysqli_query($conn, $del);
}
?>
</body>
</html>
i dont the users getting the same number and when the database finishes all the rows i want to stop serving the numbers.
numbers in the database are unique.
numero
11-12-13
13-14-17
23-45-55
ps: the code works i just need an alternative solution instead of deleting my rows in database and replacing each day with a new table.
question from:
https://stackoverflow.com/questions/65916585/how-can-i-use-an-alternative-of-this-code-im-trying-to-give-a-different-number 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…