Hi,
This is my php code which works fine:
<?php
$query1=("SELECT user_id FROM wp_usermeta WHERE user_id IN (SELECT user_id FROM wp_usermeta WHERE meta_key = 'rcp_status' AND meta_value = 'active') AND meta_key = 'rcp_subscription_level' AND meta_value > 0");
$result1=mysql_query($query1);
$num1=mysql_num_rows($result1);
while ($row1 = mysql_fetch_array($result1))
{
$user_id = $row1["user_id"];
$query2= "SELECT user_email FROM `wp_users` WHERE `ID` = '{$row1['user_id']}'";
$result2=mysql_query($query2);
$num2=mysql_num_rows($result2);
while ($row2 = mysql_fetch_array($result2))
{
$user_email = $row2["user_email"];
echo $user_email;
echo '<br>';
}
}
?>
In this code, the results of $query1 is used to query a different table ($query2). Using this logic is there a query to achieve the same result instead of writing so much php code? Please bear in mind that both the tables have got a different table structure.
Thanks for your help.