Users doesn’t like always to see static webpage.Always there should be new thing in the homepage. Otherwise users do not came back . One of my site had this issue .There are few alternatives for this.

We can plugin RSS feed from some other site. – This will make the web page dynamic. But if a user might go directly to that RSS feed provided site using home page links.

So the second option is frequently updated home page. Since my site is about free books, I’ve decided to put some thing called “Free Book Of the day” .

This is a manual work , can’t we automate this… finaly I found a solution.

I have created a separate php that gives a book url and details from the database.

Every user will see randomly selected book from the database.And also I’m displaying current date dynamically.

Here is the output…

Free Book of the day

Here is the php script to get current date ;

<? echo ‘Book Of the Day ‘.date(’l dS \of F Y’); ?>

image is static , this will not be change d.

This is how I select random record from the database…

$result = mysql_query(”SELECT `Books`.`Title`,`Books`.`BookName`, `Books`.`Desc` FROM `Books` order by rand() limit 0,1 “);

order by rand() limit 0,1 - this is the important part. This query randomly picks a record.