PHP Help Needed Afore Ah Go Mad!!!
Hi Folks
Greetings fi Scotland!
First post here (and Im pretty new to the auld PHP / MySQL so please - assume I know not a lot ;-)
OK ... so, here is my problemo - ... I have;
1 x table with 2 fields (id, email) .. with 2 email addys in for test purposes
1 x table with details to be issued and sent to ALL email addresses in the above table ...
Now...I have this code below (which basically, after I've updated the details on gig page, will send a notice to all email subscribers telling them the details of hte gig ... this is still in test so dont worry about hte content itself ...
My problem - the stoopid thing sends the email to the last ID on the member table!!! WHY WHY oh bloody why!!
Here is the code in question:
$result = mysql_query("select * FROM member order by id");
while($r=mysql_fetch_array($result))
{
$email=$r["email"];
$to = $email;
$subject = "Gig Information";
$body = "Venue: $venue \nDate: $date \nDoors: $doors \nSupport: $support \nPrice: $price";
}
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
include 'library/closedb.php';
?>
Now, this DOES work to a point i.e. it does send out the gig variables ($venue etc) which I pulled in .. all cool, the problemo is my loop methinks..but I am a real amatuer at this and basically have read tutorials and self taught myself ... so, possibly missed some fundamentals.
ANY HELP ANYONE GIVES IS MUCHOS APPRECIATEDO!
Ta very much.
(getting madder by the minute) Scotsm...
|