How to get emails from 2 MySQL tables
Hi,
I need to use only 1 query to get all emails which are stored in two different tables.
This then goes on to create an array and gets imploded for emailing, and another variable explodes it for displaying as a list on the page.
Here is the query which gets the emails from 1 table, but is missing the statements to get the emails from the other table (named: clients)
<?php
//Get users emails//
$user_sql = "SELECT * FROM users GROUP BY email";
$user_query = $con->query($user_sql);
//$user_row = $user_query->fetch_array();
//implode//
$user_emails = array();
while($user_row = $user_query->fetch_array())
{
$user_emails[]=$user_row["email"];
}
//Set variables//
$email_recipients = implode(", ", $user_emails);
$user_recipients = explode(',', $email_recipients);
?>
Thanks!
