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 = "author@email.com";

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

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

$headers = "From: me@me.com\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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.