Hopefully this is something simple I'm missing. When an insert query is done, I want an automatic email sent to members email addresses, which are stored in a different table than the insert table.
The table I'm inserting into is called "artist". After the insert query, I want to query a table named "maillist" to get the members email addresses. The "maillist" fields are named id, email_name, email. I keep getting a parse error on line 13. Heres the code i have.
php
include("dbinfo.inc.php");
$my_website=("www.mdhwebdesign.com");
$dbh=mysql_connect ("localhost", "$username", "$password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("$database");
$query="INSERT INTO artist VALUES ('','$fname','$email','$category','$artist_name',' $song_title','$lyrics','')";
$result=mysql_query($query);
$query2=("SELECT email_name,email FROM maillist");
$result2=$this->db->db_query($query2);
$row=$this->db->db_fetch_array($result2);
$emails=$row['email_name'];
while($row=$this->db->db_fetch_array($result2)) {
$emails=. "," . $row['email_name'];
}
$message = "$fname has just added the song '$song_title' by '$artist_name to our website.";
mail($emails,"A new song has been added.",$message,"From: $my_website\r\n");
echo "<meta http-equiv=\"refresh\" content=\"0; url=maillist.php\" />\n";
/php
Any thoughts?