PHP:每天一次随机结果,

PHP: I know RAND() function will return the result in random order. But I want to get the Random Result once a day. So every day there will be different order but that order should be fixed for that day. [SELECT * FROM Table_Name ORDER BY RAND();]

How can I achieve this, Is there any way to do it.?

hope this helps

select * from TABLE order by rand(dayofyear(CURRENT_DATE)) limit 1

You can't solve this with a single query. Instead you should create a separate table with a random order that you re-generate once per day.

Use the function shuffleIt from this answer and pass it Unix time stamp of the current day.

shuffleIt(
  $array,
  strtotime(Carbon::now()->toDateString())
);

This will always return same result for one day.