I'm new to sql and php.
It's as follows, I have an affiliate system that I need to bring a user's affiliate list to.
For this I use:
<?php
//traz os usuarios
$query = sprintf("SELECT referral_user_id FROM magry_awoaffiliate_referral where affiliate_user_id = '$userid'");
$dados = mysql_query($query, $con) or die(mysql_error());
$linha = mysql_fetch_assoc($dados);
$total = mysql_num_rows($dados);
$teste = $linha['referral_user_id'];
?>
<?php
if($total > 0) {
do {
?>
<ul>
<li><?=$linha['referral_user_id']?></li>
</ul>
<?php
}while($linha = mysql_fetch_assoc($dados));
}
mysql_free_result($dados);
?>
This query brings me the list of IDs of this user, but I need to get the name of each user that is in another table (magry_users).
How do I bring this information?
In the affiliate table, I have the referral_user_id that does not have its name and in the table magry_users I have the id (which is the same id as referral_user_id) and the username.
I want to bring the name here:
<li><?=$linha['referral_user_id']?> - "nome do usuario"</li>
Thank you!