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

  • SEARCH
  • Home
  • 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 7547939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:35:04+00:00 2026-05-30T09:35:04+00:00

Im adding points to a db for when a user does somit on site.

  • 0

Im adding points to a db for when a user does somit on site.
Alls I would like to do is get the points for the last 7 days and total them.

In my DB I have it saved like: PointsID, PointsUserID, PointsTotal, PointsDate

I guess I just need to figure out the latest date in the db, then minus 7 days, then get the values from between them. Once I have returned the values they will need to be summed so I can output one number.

Thanks, Bonxy

  • 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-05-30T09:35:06+00:00Added an answer on May 30, 2026 at 9:35 am
    SELECT SUM(PointsTotal) FROM TableName WHERE PointsUserID = 'IdInQuestion' AND PointsDate >= Date_Sub(Now(), Interval 7 Day)
    

    In the event that you are storing the date as a unix timestamp value (AKA a PHP date value) you would want to convert the one of the two values in the appropriate direction.

    for instance you could convert the field to a MySQL datetime value by replacing PointsDate with FROM_UNIXTIME(PointsDate). You could also go the other way and convert the results of DATE_SUB() by wrapping it all in a UNIX_TIMESTAMP(). Both should have equal results.

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

Sidebar

Related Questions

I have pdf page I would like to print/save from the C# windows forms
Would there be any point in adding resx files to a distributed cache? What
Adding Exceptional Handling is a good practise, but I have a doubt, In our
I have an Account model and a User model: class Account < ActiveRecord::Base has_many
I have written a c# win forms application that allows the user to open
I have an air app that collects live data from a user's action and
Possible Duplicate: one variable row inside another variable row I have script something like
I have a webpage that dynamically loads a user control. Each user control can
I use AvalonDock to have a vs-like docking style, and I use prism to
My User model has an attribute called points and when I try to update

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.