+ 1
How do I retrieve post randomly from my database
Blog data base
5 Antworten
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