Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8981381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:19:19+00:00 2026-06-15T20:19:19+00:00

This isn’t a programming specific question but more of a general question: I have

  • 0

This isn’t a programming specific question but more of a general question:

I have several quotes in my database. I can add more quotes whenever I like, but the idea is this:

Everyday a new quote is displayed and the day after that the next quote is showed. When the “limit” of the quotes is reached the first quote is displayed, allowing you to always have a quote on your website.

How would I do this?

I know there needs to be a check like “IF quote was displayed yesterday, show new quote and IF yesterdays quote is also the latest in the database start with the first quote”. I absolutely have no idea how to start with this, so a little help is much appreciated!

I’m using PHP and MySQL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:19:20+00:00Added an answer on June 15, 2026 at 8:19 pm
    function get_daily_quote(){
        $q = floor(time()/86400);  // will produce a number
        $n = 100; // num of quotes - you can count the quotes in the database or something
        $res = mysql_query('SELECT * FROM `quotes` ORDER BY `id` ASC LIMIT '.($q%$n).', 1');
        return mysql_fetch_assoc($res);
    }
    

    or use pdo instead of mysql’s old functions, but you get the point…

    EDIT

    just to explain – $q will always progress by 1 from the previous day. $q % $n will be the offest, when fetching the quote tuple from the table. we’ll order by ID to keep the results in the same order, ID will be the auto incremented primary key. this should do the trick.

    Of course if you want performance you can save it into a file and run a once a day to update it, so you will not need to query the database for it.

    EDIT
    fixed $q

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't a direct question, but more a question on how I can improve
This isn't strictly a programming question, but I'm asking it here because it's certainly
This isn't the best programming question but lets face it, the server fault guys
This isn't about a specific problem I'm having, but I have to clear something
This isn't a classic programming language question, but it's keeping me busy so I
This isn't a programming question but it's about the SDKs and the IDE. I've
This isn't necessarily a programming question, but I've hit a performance bottleneck with disk
This isn't strictly a programming question, but hopefully someone here has the knowledge to
Hopefully this isn't too specific/small a question, but I was wondering if anyone knew
This isn’t a specific question with a specific solution; but it’s rather a response

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.