Jump to content


Photo

Displaying new quote everyday


  • Please log in to reply
5 replies to this topic

#1 xux

xux
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 20 September 2006 - 11:08 AM

Hi everyone,
                I am trying to implement changing quote on a site everyday using php.please i need help.Thanks

#2 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 20 September 2006 - 11:16 AM

We need lots of details. There is no way anyone can possibly help you going by that.

#3 xux

xux
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 20 September 2006 - 11:35 AM

Thanks,
          I have the various quotes stored in a database,i want to extract one per day to be displayed in a table as the quote of the day.

#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 20 September 2006 - 11:36 AM

If you have a table of quotes in your database then simply sort the query result randomly OR delete the record after it has been used for a day.
follow me on twitter @PHPsycho

#5 xux

xux
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 20 September 2006 - 11:48 AM

Thanks,
          but how do I make sure that the quotes chanes everyday,as in replacing the quotes everyday?Thanks

#6 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 20 September 2006 - 11:53 AM

well if you add a field to the quotes table called something like 'date' and set it to NULL. when teh script runs check the current date. select records from the table where date is equal to the current date. If no records are returned select a random quote and update the date field for that quote with the current date.

You may if you wish delete all quotes with date < current date.
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users