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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:12:08+00:00 2026-06-15T09:12:08+00:00

Okay so I am trying to award jackpot entries every time a user completes

  • 0

Okay so I am trying to award jackpot entries every time a user completes a task, but I want to give out more than one entry when the task awards more than a certain amount.

Let me break this down.

When a user completes a task that awards $0.05 or more they receive 1 entry into the jackpot. What I am trying to achieve is this. When they complete a task that is worth $0.50 they receive an additional 1 entry and then for every $0.25 more they get another 1 so if they complete a task worth $1.00 they should get a total of 4 entries. 1 for the initial $0.05, 1 for the task being worth $0.50, 1 for reaching $0.75, and 1 more for reaching $1.00

I am not sure how to go about doing this. So all I have when it comes to updating in the database is this.

if($offprate >= $rafminp || $offcrate >= $rafminc){
$stmt=$db->prepare("UPDATE accounts SET jackpot_e=jackpot_e+'1' WHERE username = ?");
$stmt->bind_param('s', $username);
$stmt->execute();
}

which is just for the initial $0.15

  • 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-15T09:12:10+00:00Added an answer on June 15, 2026 at 9:12 am

    Am I thinking too simple?

    $amount = 0.5;
    $credits = 0;
    switch($amount) {
      case 0.05: $credits = 1; break;
      case 0.50: $credits = 2; break;
      case 0.75: $credits = 3; break;
      case 1.00: $credits = 4; break;
    }
    $stmt=$db->prepare("UPDATE accounts SET jackpot_e=jackpot_e+'$credits' WHERE username = ?");
    

    Or maybe even:

    $all_amounts = array(0.05, 0.50, 0.75, 1.00);
    $credits = array_search($amount, $all_amounts)+1; # returns -1 when not found
    

    If you don’t have exact values, replace the switch statement with an if-else cascade.


    Re-reading your question, it seems that the amount has no upper bound. In that case:

    $credits = 0;
    if($amount == 0.05)
      $credits = 1;
    if($amount >= 0.50) 
      $credits = floor(2+($amount-0.50)/0.25);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I been trying to work this out but unable too. I have a
Okay I'm trying to go for a more pythonic method of doing things. How
Okay so i am trying to write a simple awk to clear out some
Okay so I'm basically trying to let the user decide which drive they would
Okay I'm trying to have a custom keypad pop-up when I want to enter
Okay so I was trying to build something similar to a real time application
Okay I've been trying to figure this out for a while now. I have
Okay I've spent the last hour trying to find a solution to this but
Okay so what I am trying to figure out is how do I count
okay so i am trying to be more efficient in my programming, by attempting

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.