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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:15:17+00:00 2026-06-04T06:15:17+00:00

i’m programming a system which records users achievements in games by collecting Trophy data

  • 0

i’m programming a system which records users achievements in games by collecting Trophy data which is uploaded to the system, it got it to work fine but i have started to think about one part of the system i can do in 2 different ways

this part of the system gathers a Trophy’s rank (Bronze, Silver, Gold, Crystal, Jade) and how many points it’s worth, each user as a record in a game’s table, each field apart from the tables primary key and the user_id foreign key represent each trophy that can be obtained in the exact order they are listed, this means they aren’t sorted in any way which a machine can easily search though

how i have combat this is that there is another table which each record contains the game and a string which lists the rank order of the trophies separated by |’s so when i use explode(STRING,”|”) i get an array and each index of the array is a single character, it can look something like this

b|b|s|g|c|g|s|j

that is just the trophy rank, the point value is done though function where i pass the game id and trophy id and a switch case statement will first check what game i have passed while nested switch cases in each case will check the id, in each case of these they return the point value of a trophy

naturally i didn’t plan out my code, the rank string above originally didn’t have the | and i didn’t do the point values like that cause unlike the rank, a score value van very between 1 and 3 digits, now i know i can do the same with the point value as i did with the rank order

i want to know which method is more efficient for the web server and for browsers, pulling a string from a database and using explode(STRING,”|”) (and intval() to convert the point values from strings to integers, need them like that for calculations) or calling a function with switch case statement like a look up table or if what i already have is efficient enough

i’m not really interested in trying to do what i am doing in a completely different way just to make it even more efficient as these methods perfectly fit the nested loops in which i am using them in

  • 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-04T06:15:19+00:00Added an answer on June 4, 2026 at 6:15 am

    try reconstruct your db, there could be a table achievements with a many2many relations to users,trophy tables..columns user id, a trophy id, total points and/or other data with a view you can get the username,trophy type, and points

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
i got an object with contents of html markup in it, for example: string
I want to construct a data frame in an Rcpp function, but when I

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.