0

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.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by cwkeng09
0
$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);
}

Edited by pritaeas: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.