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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:52:36+00:00 2026-06-10T17:52:36+00:00

I am designing a database for an MMORPG, and the administrator back end. I

  • 0

I am designing a database for an MMORPG, and the administrator back end. I need a function that will allow me to add a specified amount of the game’s primary currency: Gold to each account in the database.

This is what I have:

function massAddGold($gold_amount){
    dbconnect();
    $value=mysql_query("SELECT * from `mmo_db1`.`users`;");
    while ($row=mysql_fetch_array($value)){
        $currentgold=$row['gold'];
        $newgold=$currentgold+$gold_amount;
        mysql_query("UPDATE  `mmo_db1`.`users` SET  `gold` =  \"$newgold\";");
    }
    dbclose();
}

where mmo_db1 is the name of the database.

When I execute the command, massAddGold("50"); I then check the database. It takes the row with the highest value of Gold, adds the 50 gold to that, then applies that value to all of the rows. I need it to execute on each row individually.

  • 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-10T17:52:37+00:00Added an answer on June 10, 2026 at 5:52 pm

    Why do it in two queries what is wrong with one

    UPDATE users SET  gold = gold + 50;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a database that will need to be optimized for maximum speed. All
I'm designing a database that will hold contracts and warranties. A warranty can link
I'm designing a database for internal use at my company that will store data
I am designing database tables for a master-detail scenario. The specific requirement is that
I was designing a database for a site where I need to use a
I'm designing a database which will store information about some artists. These artists can
We're designing a database in which I need to consider some FK(foreign key) constraints.
I am designing a database for a project. I have a table that has
I'm designing a database for our CRM system and need some help with the
When designing a database, what usually determines what tables will be the primary and

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.