Hello everyone! This is my first post, been a long time reader though.
First of all, it's been a while since I don't program and I'm rusty (very).
The problem is: I just can't learn how to use the JOIN or UNION commands, everything I read is confusing.
I'm simply trying to retrieve info from two different tables (same db) at the same time.
Here's my code:
if ($_POST['Teachers'] && $_POST['Students']) {
$sql = "SELECT email FROM teachers"; //Here I also want to pull this off: SELECT email FROM students.
$result = mysql_query($sql,$db);
while ($row = mysql_fetch_row($result) or die(mysql_error())) {
$mails.= "$row[0],";
}
}
The $_POST variables come from a previous page where the school's principal will select if to send a mass mail to students and teachers or just one of them, so there are other if statements above, all working good. The $mails will be used on mail().
So, that's it, I'm trying my best and I've been reading for 3 days to no avail.
Thanks in advance guys.
Carlos I. Romero. (Systems Engineer and Administration: studying in Mexico).