Hi,
This is my first post so I hope I've done it right. I am having trouble
querying an email address from MySQL and then placing that field into the
PHP mail function. It doesn't work. Here's my code:

$query_string = "SELECT Email FROM instructors WHERE HSA_NO = '$insthsaid'";
  $result = mysql_query($query_string);


  while ($myrow = mysql_fetch_array($result))
  echo $myrow[Email];
  $myaddress = $myrow[Email];


 $address = trim($myaddress);
 echo $address;

 $subject = "test";

 $body = ("This is a test");

 mail($myaddress, $subject, $body, "From: HSA Website");


I get the address to print out with 'echo $myrow[Email]' , but nothing
prints out from 'echo $myaddress' or  'echo $address' and no email is sent.
I don't understand why this is happening. Any help would be appreciated.

thanx
John Visicaro

Reply via email to