How can I display a new quote each day - to get a quote from the DB is simple, but how to change the quote every 24 hours?

Recommended Answers

All 2 Replies

Did you mean you want to change the quote at a certain time daily?

Hi,

I would have the id number of the quote and the time it was lasted changed stored somewhere. The database would be the obvious choice, but you could use a cookie or something. Then each time the page loads, check the stored information, when the current quote was first used, what the time is now, and if its greater than 24 hours, load either the next quote (e.g. increment id), or generate a random number between 1 and the number of quotes in the database and load that quote. Oh, and updated the stored time and id number.

There might be a simplier method, but this is what I'd do.

R.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.