Hi,
When I register a member using my script, why one of the column have "Resource id #14"??
Below is the code:
if($do->new_user($username, $encoded_password, $email, $alertpay, $referral, $country, $c, $referral2))
{mysql_query("INSERT INTO history (username,type,time,custom1,custom2,custom3,custom4,custom5) VALUES ('{$username}','joined',unix_timestamp(),'0','0','0','0','0')");
mysql_query("UPDATE users SET balance=balance+'0.20' WHERE username='{$referral}'")or die(mysql_error());
mysql_query("UPDATE stats SET users = users + '1'");
{
$referral2 = mysql_query("SELECT `upline` FROM `users` WHERE username = '$referral'");
mysql_query("UPDATE `users` SET upline2='{$referral2}' WHERE username='{$username}'");
}
$show_page=0;
}


the "Resource id #14" appear inside column "upline2".
Please help me, thank you.

$referral2 = mysql_query("SELECT `upline` FROM `users` WHERE username = '$referral'");

$referral2 is a resource. You use this in your query. You should first use mysql_fetch_assoc to retrieve the column you need.

$result = mysql_query("SELECT `upline` FROM `users` WHERE username = '$referral'");
if ($result) {
  $row = mysql_fetch_assoc($result);
  $referral2 = $row['upline'];
  mysql_free_result($result);
}

thank you pritaeas, my problem was solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.