zero-perfoliate
zero-perfoliate

Author Topic: Email script problems  (Read 162 times)

Offline blink359

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
Email script problems
« on: July 22, 2010, 11:22:30 AM »
Hi i am trying to make a script in which you can enter a message into a form and then send it to every email that is stored in a database and so far i have had lots of problems with what i was told would and should work, i have managed to make a script that puts the information into the database which is
THIS ONE WORKS:
Code: [Select]
<?php
mysql_connect
("mysql12.000webhost.com","a9855336_root","n4th4n");
mysql_select_db("a9855336_mail");
mysql_query("INSERT INTO mail   (name, email, password) VALUES('{$_POST['name']}', '{$_POST['email']}', '{$_POST['password']}' ) "
or die(
mysql_error());  

echo 
"Email Address Added";

mysql_close
?>
But the script to use the emails doesnt work im getting lots of Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/massemail.php within the first 1-8 lines of the script which is: (Lines that seem to have problems according to adobe dreamweaver CS5 will be marked
THIS ONE DOESN'NT  WORK:
Code: [Select]
<?php
mysql_connect
("mysql12.********.com","a9855336_*******","********");
mysql_select_db("a9855336_mail");

THIS LINE$mail "$_POST['from']";
THIS LINE$result "mysql_query("SELECT email FROM mail)";

while ($row = mysql_fetch_array($result))  

THIS LINE$to = $row['email'];

$subject = $_POST['subject'];
$message = $_POST['message'];
THIS LINE $from = "
$mailid@example.co.uk";
mail('$to', '$subject', '$message', null,
   '-$from');

?>
My database info is as follows
database name: a9855336_mail
Table Name: mail
Row name: email

If someone knows what is wrong with my script please tell me also if you know another way of doing this then please also tell me or point me to any websites/guides or other forum posts that will help me

Thanks,

Blink359

 

zero-perfoliate