What do you think of this way to generate a random number from the total rows in a table? I would like to create a page that random.php precisely generates a random ID and shows it.require 'includes/config.php';$pdo->query('SELECT id FROM xxxx');$pdo->resultset();$total = $pdo->rowCount();//echo random id$id = rand(1, $total);$pdo->query('SELECT * FROM xxxxx WHERE id = :id AND status = :status');$pdo->bind(':id', $id);$pdo->bind(':status', 1);$rand = $pdo->single();echo $rand['id'];
Select random row using PDO
php;sql;random;pdo