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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:07:27+00:00 2026-05-25T20:07:27+00:00

Hey does anyone know a reason why this is not working? its not calculating

  • 0

Hey does anyone know a reason why this is not working? its not calculating any of the additions and just entering 0 into the database. Any help would be great, thank you!.

$member_id = //users member id in database//
$track = //the track results being updated//
$engine = //the engine id from the members table in database//

$engine_points_system = array();
$engine_points_system["qualpos1"] = 30; 
$engine_points_system["qualpos2"] = 20;
$engine_points_system["qualpos3"] = 18;
$engine_points_system["qualpos4"] = 17;
$engine_points_system["qualpos5"] = 16;

$enginepoints = 0;
$qualifyingpoints = 0;

$results_query = mysql_query("SELECT pos_1, pos_2, pos_3, pos_4, pos_5 
from engine_qualifying_results WHERE track_id = '$track'")
or die ("Failed to update" . mysql_error());

$row = mysql_fetch_array($results_query);

$enginequalifying = array();
for ($i = 1; $i <= 5; $i++) {
     $enginequalifying["pos$i"] = $row['pos_$i'];
}

for($i = 1; $i <=5; $i++) {
    if($engine == $enginequalifying["pos$i"]){              
        $enginepoints += $engine_points_system["qualpos$i"];
        $qualifyingpoints += $engine_points_system["qualpos$i"];
    }
}

$results_query = mysql_query("INSERT INTO member_results (member_id, engine_points)              
VALUES ('$member_id', $enginepoints')")
or die ("Failed to update" . mysql_error());
  • 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-05-25T20:07:27+00:00Added an answer on May 25, 2026 at 8:07 pm
    $enginequalifying["pos$i"] = $row['pos_$i'];
    

    In this line you have 'pos_$i'. This is the literal string 'pos_$i'. You should use "pos_$i" instead.

    $enginequalifying["pos$i"] = $row["pos_$i"];
    

    UPDATE:

    In your code $enginequalifying is redundant, and not needed. You can just use $row in its place.

    for($i = 1; $i <=5; $i++){
      if($engine == $row["pos_$i"]){              
        $enginepoints += $engine_points_system["qualpos$i"];
        $qualifyingpoints += $engine_points_system["qualpos$i"];
      }
    }
    

    Also, as @ax. points out, you have an extra ' (or a missing ') in your INSERT.

    $results_query = mysql_query("INSERT INTO member_results (member_id, engine_points)
      VALUES ('$member_id', '$enginepoints')")
    or die ("Failed to update" . mysql_error());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey does anyone know of any good contact picker tutorials for android? I need
Hey there - does anyone know what I need to do to set up
Hey guys, Does anyone know how to make the Text View transparent and add
Hey, does anyone know how i cant get a href link too run a
Hey guys. Does anyone know what do I have to enter in the DTD
Hey, I really like the way foursquare's website feed is built. Does anyone know
Hey does anyone know if theres a way in Visual Studio to filter the
Hey , does anyone know why a winform application in windows, reaches via the
Hey guys I know that this is probably just a simple sql statement but
Hey is this the correct way to do concatenation? it does not seem to

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.