Jump to content

Emailing From Table


nthrusse

Recommended Posts

I have little or no! idea what I am doing..  But I foolishly decided I would try some coding..

 

What I want is to query two table and then send an email to each record holder in the database.  I have pieced together this...  But it doesn't give me the results of all my vaiables and it doesn't email all the results.

 

Ideas, directions anything would be helpful..

 

<?php

include "vsadmin/db_conn_open.php";

$allprods=mysql_query("select pID, pName, pPrice, pDropship, dsID, dsName, dsEmail from products, dropshipper where pDropship = dsID");

while ($yarr=mysql_fetch_assoc($allprods))

$aname=$yarr["pID"];

$bname=$yarr["pName"];

$cname=$yarr["dsName"];

 

$to = "[email protected]";

$subject = ("Your Ebook  " . $aname);

$body = ("Hello,\n\nHow are you you ". $aname ."?\n\nWhats New With you in the World?" . $aname ) ;

$headers = "From: [email protected]\r\n" .

  "X-Mailer: php";

if (mail($to, $subject, $body, $headers)) {

  echo("<p>Message sent again!</p>");

  } else {

  echo("<p>Message delivery failed...</p>");

  }

?>

 

Link to comment
https://forums.phpfreaks.com/topic/219848-emailing-from-table/
Share on other sites

Thanks for the quick response...

 

 

yes, I know I need to assign a variable in the $to..  But for testing I didn't want to send it to all the email addy's in the database.

 

The issue is it shows $aname, but not $bname or $cname in my email.. and theretically, if I have 5 records it should send out 5 emails and it doesn't

Link to comment
https://forums.phpfreaks.com/topic/219848-emailing-from-table/#findComment-1139658
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.