excellent. yeah that was it. i want to show you the rest of the code too. what i am trying to do is send weekly updates of new members (those who signed up within the past 7 days) to members of my database. the new member information would be sent to those members that have the same city and genre_select of the new members.
i am attempting the queries in 3 steps.
1)select the city and genre of entries in the database that have been created in the past 7 days.
2)match these cities and genres of already existing members that have answered YES to receive the updates.
3)send information of these new artists to the existing artists that have the same city and genre of the new artists.
I am having a problem with the $emailresult query. i don't think it likes the Date_Created > curdate()-7 statement. i keep getting the message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bogglepr/public_html/weeklyupdate.php on line 20
Here is the code:
$newartist = mysql_query("SELECT Distinct City, Genre_Select FROM Musicians_Network WHERE Date_Created > curdate()-7", $db);
if ($myfirstrow = mysql_fetch_array($newartist)) {
do {
$result = mysql_query("SELECT Contact FROM Musicians_Network WHERE (City = ".$myfirstrow['City']." or Genre_Select =
".$myfirstrow['Genre_Select'].") and Updates = 'Yes'",$db);
$emailresult = mysql_query("SELECT Artist_Name, City, State_or_Province, Country, Genre_Select, Genre_Enter Artist_Function,
Homepage FROM Musicians_Network WHERE (City = ".$myfirstrow['City']." or Genre_Select = ".$myfirstrow['Genre_Select'].") and
Date_Created > curdate()-7",$db);
if ($myrow = mysql_fetch_array($emailresult)) {
do {
$update_email = $update_email.",".$myrow["Contact"];
} while ($myrow = mysql_fetch_array($emailresult));
}
}while ($myrow = mysql_fetch_array($newartist));
$update_recipient = $update_email;
$update_subject = "A new artist in your city or genre has been added";
$update_message = "Artist Name: $Artist_Name
Location: $City, $State_or_Province, $Country
Genre: $Genre_Select, $Genre_Enter
Function: $Artist_Function
Homepage: $Homepage";
$update_extra = "From: Boggle_Productions<>\r\nReply-To: ()\r\n";
mail ($update_recipient, $update_subject, $update_message, $update_extra);
thank you for all your help.