php - Trouble Shuffling a MYSQL Result Set -
via database returning array by:
print_r($stmt->fetchall(pdo::fetch_assoc));
as expected looks there. add php "shuffle" function so:
print_r(shuffle($stmt->fetchall(pdo::fetch_assoc)));
the result "1". no shuffled array.
i wanting query result set , them output them in random order guarantee of no duplicates. in regards appreciated. thanks.
shuffle() takes reference array , return boolean, should do:
$result = $stmt->fetchall(pdo::fetch_assoc); shuffle($result); print_r($result);
Comments
Post a Comment