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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:14:10+00:00 2026-06-13T21:14:10+00:00

I have been brainstorming for ideas on the best ways to notify a user

  • 0

I have been brainstorming for ideas on the best ways to notify a user that they have unlocked a badge. It does not need to be instantaneous or live. I was thinking at least every time they view their dashboard it would run to check the status then display. Here is the general direction I have been thinking.

I have two tables. One called badge_status and another the users table.

in the users table I have the users and the badge fields such as Badge1, Badge2, Badge3 and etc. The badge fields default value are set to “locked”. When the users do the right actions to unlock the badge the field then becomes “unlocked”

I was thinking of a set up like this for the notifications but am wondering if it is overkill or there is an easier way?

<?php
$db = new PDO('mysql:host=hostname;dbname=dbname;charset=UTF-8', 'username', 'password');
$username = $_SESSION['jigowatt']['username'];
$statement = $db->prepare("SELECT badge1, badge1_status FROM login_users, status_table WHERE username = :username");
$badge1 = $row['badge1'];
$badge1_status = $row['badge1_status'];



if($badge1_status == "finished")  {
}
else if($badge1 =="unlocked")   {
// Show fade in pop up div for notification <div id="notification-div">Badge Unlocked!</div>
$setBadgeValue = $db->prepare("UPDATE status_table SET badge1_status='finished' WHERE username= :username");

}

<?

I would have the second table set up if the status of badge 1 is “finished” then it won’t do anything, thus making sure the notification only displays once.

if it is not finished and badge1s status is “unlocked” the then show the notification DIV and then write to the table for badge1_status as “finished”.

On a side note I am still in the process of converting over to proper PDO. Thanks for any advice, tips or improvement you can give on this setup!

  • 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-13T21:14:11+00:00Added an answer on June 13, 2026 at 9:14 pm

    As requested, here’s an answer version of my comments:

    Rather than put info on each badge as columns in the user table, make a cross-reference table that can join between users and badges, e.g.

    users (user_id, name)
    badges (badge_id, name)
    user_badges (user_id, badge_id, date_earned)
    

    Setup foreign keys between user_badges and the two referenced tables.

    This allows you to have an unlimited number of badges. Adding a new one later is as simple as adding a row to user_badges, rather than trying to ALTER your (hopefully huge) user table.

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

Sidebar

Related Questions

Ok so I have been playing with VB.net and brainstorming ways to accomplish launching
Have been trying to encrypt an xml file to a string so that I
In C (or C++ for that matter), pointers are special if they have the
I have been developing line drawing apps that produce lines such as these: I
Have been stuck with this issue for a few days now, and really need,
Have been looking at the MVC storefront and see that IQueryable is returned from
Have been playing around with instruments with not much luck in figuring out how
Have been searching for this, I need to have a conditional statement in my
I have about 5,000 hard copy forms that i need to be converted to
Have been trying to find a good description of what the next() method does.

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.