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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:50:58+00:00 2026-06-17T11:50:58+00:00

I need some support regard a MySQL query. I really don’t know if possible

  • 0

I need some support regard a MySQL query.
I really don’t know if possible to do that only via MySQL query, as I would like to skip a complex PHP function.

I have this query in a PHP script that update my database every 5 minutes (via CRON) from a parsed XML feed:

INSERT INTO $jackpot->gameId (gameId,gameName,amount,currency,date,hit,hit_date) VALUES (\"$jackpot->gameId\", \"$jackpot->gameName\" , \"$jackpot->amount\", \"$jackpot->currency\",CURRENT_DATE(),0,NULL) ON DUPLICATE KEY UPDATE amount=$jackpot->amount

Now, I would “enhance” this query.
I need to UPDATE the “hit” and “hit_date” columns when the “amount” value is down (for example) of a 90% of the previous value.

Something like this, in two words (no query)

Execute query-->update rows-->check if 'amount' value is down 90%--> if yes --> update hit (set to 1) and update hit_date (CURRENT_DATE()).

Is possible to do that via MySQL or I have to write a more complex php script?

Any help would be really appreciated! Thank you!

  • 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-17T11:50:59+00:00Added an answer on June 17, 2026 at 11:50 am

    You’ve hardly provided any code to go off here, so I’m guessing you are using mysqli otherwise please adapt:

    $query = mysqli_query("SELECT amount FROM " . mysqli_real_escape_string($jackpot->gameId) . " WHERE gameId = '" . mysqli_real_escape_string($jackpot->gameId) . "' ORDER BY hit_date DESC LIMIT 1");
    $current = mysqli_fetch_array($query, MYSQLI_ASSOC);
    
    // run the insert here
    
    if((($current['amount'] - $new['amount'])/100) <= 0.9) {
        // UPDATE table SET hit = 1, hit_date = CURRENT_DATE() WHERE gameId = $jackpot->gameId
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to working with timers on the iPhone and would need some support.
I need some support as I'm not so skilled in PHP and MySQL like
I'm building my own JSP Tag Library which need to support some features that
I'm using Jetty with mysql. I need some basic transaction support, and jetty is
Now I'm working on Qt project and I need some MySQL support. MySQL was
I have a problem that drives me crazy and I need some support. I
Need some help... I have jasperserver 4.1 installed on my ubuntu. It runs via
Need some guidance figuring out what went wrong. I've been using mysql, phpmyadmin for
We have recently shifted to asp.net mvc, but we still need to support some
I need some embeddable language for tasks similar to query execution in mongodb. Language

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.