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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:16:16+00:00 2026-06-07T23:16:16+00:00

$pullItem = mysql_query(SELECT * FROM items WHERE item_id = ‘$itemid’); while ($fetch = mysql_fetch_array($pullItem))

  • 0
$pullItem = mysql_query("SELECT * FROM items WHERE item_id = '$itemid'");
while ($fetch = mysql_fetch_array($pullItem)) {
    $statinc = $fetch['statinc'];
}

$pullUserStats = mysql_query("SELECT * FROM userstats WHERE user_id = '$uid'");
while ($fetch = mysql_fetch_array($pullUserStats)) {
    $curstat = $fetch[$statinc];
}

mysql_query("UPDATE userstats SET $statinc=('$curstat' + '$incamount') WHERE user_id='$uid'"); //LINE 76

This is where I’m having trouble. I do have some coding in between, but my error is this:
“Notice: Undefined variable: curstat in ….. on line 76”

  • 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-07T23:16:18+00:00Added an answer on June 7, 2026 at 11:16 pm

    There are a few things wrong with the logic behind this code that make it seem like it’s either not coded to look like what it’s actually doing, or it’s just possibly not doing what you want it to do.

    The first thing is that with the way you wrote the code, it looks like you want to loop through a bunch of results in the while loops, and when you get to the end of the loop, $statinc is the value of the LAST result of the query.

    SELECT * FROM items WHERE item_id = '$itemid' suggests that you either have a bunch of items with the id field item_id, or you named what should possibly just be named id asitem_id.

    If it’s the second case, your first query that loads the items should actually look like:

    $pullItem = mysql_query("SELECT * FROM items WHERE item_id = '$itemid'");
    $item = mysql_fetch_array($pullItem); //There's only one item to be returned, no need to loop over the array over and over again
    $statinc = $item['statinc'];
    

    Which also means that your second query should look like this:

    $pullUserStats = mysql_query("SELECT * FROM userstats WHERE user_id = '$uid'");
    $userstat = mysql_fetch_array($pullUserStats);
    $curstat = $userstat[$statinc];
    

    This leads me to believe that userstat is returning an empty query, and thus in your original code, $curstat is never getting set.

    $increase_stat_to = $curstat + $incamount;
    mysql_query("UPDATE userstats SET $statinc=('$increase_stat_to') WHERE user_id='$uid'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pull item quantity from a DB2 database from an aspx page
I'm implementing a Knuth shuffle for a C++ project I'm working on. I'm trying
Here is my code: <?php // Returns a random RGB color (used to color
Currently I have this.. which works fine <asp:ImageButton ID=ImageButton1 runat=server Width=80 Height=60 ImageUrl='<%# Bind(ImageUrl)
I have this form: <FORM id=frmVote action=../vote_dir/proccess.php method=post> <table id=tblMain align=center> <tr> <td class=header></td>
I'm attempting to integrate zeromq into a glib main loop, but I can't figure
In the web service I'm working on, I need to implement a URI with
First off, this is very similar to Collection of complex child objects in Asp.Net
I am writing a TCP connection based DLL. The basic premise is that it
So I'm using Spree as my shopping cart in Ruby on Rails. Spree is

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.