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 986191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:16:54+00:00 2026-05-16T05:16:54+00:00

This is to be an application-agnostic question, but one I’d like to get a

  • 0

This is to be an application-agnostic question, but one I’d like to get a better answer on.

What is the best set-up to track users completing a challenge or goal? Think similar to Stack Overflow, where if you hit a certain target you’re awarded a badge.

Currently, I’m the developer of a website and attached Facebook application. I want to know the best way to track challenges completed. Currently, I have a single line of code sprinkled in with the actual controller code, which probably isn’t the best way. Something like the following:

if ($upload_photo == true) {
    $challenge->perform(1);
}

As you see, the above basically fires off a call to the perform() method (of the Challenge class), which has a database look-up to see if the challenge threshold has been met thus far and if not, inserts a record and credits the member with the number of points associated with that challenge. The database set-up for this is simple, as follows:

member_id INT
challenge_id INT

And to get the number of times a member has performed a specific challenge, I just run a COUNT (*) AS count FROM table_name WHERE member_id = ? AND challenge_id = ? query.

But is this the best set-up? I think not, and open to answers on how to improve this set-up.

As aforementioned, I’m also in charge of developing a Facebook application associated with this website. There will be a progress bar that will allow users to perform certain actions and be rewarded for them. For example, bookmarking the application; liking the application; and suggesting the application to their Facebook friends.

Using Facebook’s PHP SDK I can query if these actions have been done. No problem there. My problem comes for users who will leave the application, then return at a later time when there session’s expired. When an action has been performed, should I store that as a record in a database table, and just query the database when a user logs into the app? Or should I just do the checks on login and store the results in a session, overwriting the relavant session keys when they trigger the relavant action?

Any suggestions for improvement on this set-up would be welcome. Thanks in advance.

  • 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-16T05:16:55+00:00Added an answer on May 16, 2026 at 5:16 am

    Are you looking for advice on how to store the goals in the database? If so, the tried and tested many-to-many relationship sounds appropriate in your situation.

    A table that contains users, a table that contains goals and an intermediary table containing the identifiers of each table where the users have achieved that goal.

    I’m sure you’re aware that with your idea of storing the data in the session, this data will be lost when the session is destroyed. Whether or not you care about that is up to you. If it’s in the database then at least it is available to you indefinitely.

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

Sidebar

Related Questions

Firstly, this DB question could be a bit DB agnostic, but I am using
I'm doing this application in C# using the free Krypton Toolkit but the Krypton
This is going to be quite a vague question but I am wondering how
I have this application I'm developing in JSP and I wish to export some
The company where I work created this application which is core to our business
I'm working on a document application and part of this application I've to add
Forgive me for probably using the wrong term for this application mode. Our application
I am currently receiving this error: Validation of viewstate MAC failed. If this application
I have an existing application that is written in C++ for Windows. This application
the directory structure I'm trying to achieve would be this: application/default/views/layouts/layout.phtml application/default/views/scripts/index/index.phtml application/admin/views/layouts/layout.phtml application/admin/views/scripts/index/index.phtml

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.