Auto-update proverb once per day.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kavithadevan
    New Member
    • Jul 2007
    • 23

    Auto-update proverb once per day.

    Hi,
    In my website i am trying to update proverb daily (automatically it gets changed according to our time) like this but i cant get any idea about how to update that .Can u tell me some ideas and can u give me some working examples.

    thanks
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Don't put off until tomorrow, what you can do today

    Comment

    • kavithadevan
      New Member
      • Jul 2007
      • 23

      #3
      Sorry

      I asked some idea about how to update proverb automatically in my website but u send proverb.

      Originally posted by code green
      Don't put off until tomorrow, what you can do today

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Changed thread title to better describe the problem.

        Heya, kavithadevan.

        Code Green was being facetious. He was implying that you could stop by TheScripts every day, and we'll supply you with a new proverb!

        You have a couple of options. These are the two easiest ways that don't require scheduling scripts:

        - You can display a random proverb every time the User loads the page. This is the easiest way to do it.

        [code=mysql]
        SELECT
        *
        FROM
        `Data_Proverbs`
        ORDER BY
        RAND()
        LIMIT 1[/code]

        - You can display a different proverb depending on what day of the year it is. This is slightly more difficult, but still pretty easy.

        [code=php]
        $sql = '
        SELECT
        *
        FROM
        `Data_Proverbs`
        WHERE
        `proverbid` = \'' . (date('z') % 365) . '\'
        LIMIT 1';
        [/code]

        Comment

        Working...