Hi there everyone,
I'm trying to alter a donations tracking system to retrieve the user's username, instead of the first name in the paypal transaction. I'm failing miserably. Here's my latest iteration:
$sql="SELECT user_id,mc_gross FROM donation_paypal ORDER BY id DESC LIMIT 10 ";;
$result_set=mysql_query($sql) or die (mysql_error());
$numr=mysql_num_rows($result_set);
if($numr>=1){
while($rows=mysql_fetch_array($result_set)){
$user_id = $rows['user_id'];
$sql="SELECT username FROM phpbb_users WHERE user_id='$user_id'";;
$result_set=mysql_query($sql) or die (mysql_error());
while($rows=mysql_fetch_array($result_set)){
$username=$row['username'];
echo("
<tr>
<td align='left'>".$username."</td>
<td align='right'>$".$rows['mc_gross']."</td>
</tr>");
}
}
}
Which is resulting in blank content both for username and for rows['mc_gross']. Here's the initial code(that worked for printing the first name and gross.):
$sql="SELECT first_name,mc_gross FROM donation_paypal ORDER BY id DESC LIMIT 10 ";;
$result_set=mysql_query($sql) or die (mysql_error());
$numr=mysql_num_rows($result_set);
if($numr>=1){
while($rows=mysql_fetch_array($result_set)){
echo("
<tr>
<td align='left'>".$rows['first_name']."</td>
<td align='right'>$".$rows['mc_gross']."</td>
</tr>");
}
}
Hopefully you can see that I tried to insert another while loop inside the original to try to get the username based on the user_id gathered from the first. Echoing the sql statements results in what I thought was a valid statement, but I'm just getting empty values for both.
Could someone show me how to properly do this? I've run out of ideas.
thanks,
json