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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:05:07+00:00 2026-06-11T21:05:07+00:00

I am trying to do is add value to a user who referred the

  • 0

I am trying to do is add value to a user who referred the logged in user after the logged user has opened a certain page

so i made a few changes and im now getting the following error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource 
in C:\xampp\htdocs\test\goingback_t_play_150.php on line 18

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in  
C:\xampp\htdocs\test\goingback_t_play_150.php on line 20
, 

here is my code

<?php
session_start();
?>
<?php
// Adjust MySQL connection settings...
$mysql_hostname = "localhost";
$mysql_user = "user";
$mysql_password = "";
$mysql_database = "";
$bd = mysql_connect($mysql_hostname,    $mysql_user,$mysql_password) or die("");
mysql_select_db($mysql_database, $bd) or die

$sql="SELECT * FROM users where id={$_SESSION['refcode']}"; 

$val = 2; //#2 : Why do u need the ()?
$result = mysql_query($sql,$bd);
$data=mysql_fetch_assoc($result);
if (mysql_num_rows($result)==1) {
// equate the value to a variable to use outside
// this while loop
 $acc_balance = $data['com_balance'];

$commision = $data['id'];
}
$remainder = $acc_balance + $val;       
$update_query = mysql_query("UPDATE users SET com_balance = '".                 
mysql_real_escape_string($remainder) ."'
WHERE id='refcode'"); 
if ($update_query) {
 print "";
  • 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-11T21:05:08+00:00Added an answer on June 11, 2026 at 9:05 pm

    mysql_ usage is discouraged, I recommend you to use mysqli_ instead, more info here.

    For your problem, you should check if your variable $_SESSION['refcode'] is correctly defined.

    If this variable is correctly set, then there could be an error into your SQL syntax or inside your database.

    Try to replace :

    $result = mysql_query($sql,$bd);
    

    With this :

    $result = mysql_query($sql,$bd) or die(mysql_error($bd));
    

    Your script will output the MySQL error if there are any, since your result variable seems to be undefined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to add value into foreign key field, if same data doesn't exist
I am trying to add value to CoreData from .plist and get from coreData
I am trying to add the value of each bar to my bargraph. I'd
I'm trying to add a value (in this case the string I Added This)
I'm trying to add a value to the header for a URL request. Something
I am trying to add a key value pair and having trouble adding the
I'm trying to add the selected value from the autocomplete search box to my
Trying to add a dynamic class value to one of my columns in CGridView:
I'm trying to add some additional key/value pairs to an NSMutableDictionary, using: Tag *tag1
I'm trying to add an extra class tag if an element / value 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.