+ 1
How do I retrieve post randomly from my database
Blog data base
5 Answers
0
What if I use
ORDER BY RAND()
+ 1
why would my answer be downvoted? that makes zero sense. itâs not an incorrect answer.
+ 1
Precious Obaseki you said âretrieveâ not order them randomly...
0
without knowing more about the structure of your database, i would suggest that you add all the post idâs to an array, then get the length of that array, call a random number generator to give you a random number between 0 and length-1, get the id at that location in the array, and output the post with that ID from your database
0
Maybe requesting a json from db and parse it into an object and get a random value