I have built a recipe cookbook web service and part of the web service is giving users a random recipe of the day. The recipe of the day function is to simply just output a new recipe daily. I have built the Sql statement as follows:
<?php include_once 'dbconfig.php'; ?>
<?php
$sql="SELECT * FROM recipe_2 ORDER BY RAND() LIMIT 1";
$result_set=mysql_query($sql);
$link_address = 'view.php';
while($row=mysql_fetch_array($result_set))
{
}
?>
But this will generate a new recipe everytime a user visits or refreshes the site. Is there a way to improve this code by adding a 24hr timer to the SQL statement that keeps a static recipe on a daily or 24 hour duration? Thanks