SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    i have got myself in a bit of a twist and i cannot find an answer.
    the components are 1) a form to collect information. 2) a table in mysql to hold the data 3) a page to display the data each time the page is accessed. 4) a small part of the collecting program that eMails me when the form is submitted. 5) a table with two cols -id and eMail.

    1) 2) 3) 4) work fine togeather. now i want to query 5 and put the results in place of eMail to me.

    i know the format for the email is because it works.

    $mailTo="name@isp.com";
    $mailSubject="New Notice";
    $mailBody="New Notice";
    mail($mailTo, $mailSubject, $mailBody);

    the thing i want to do is query the email table, string all of them togeather in the form "1","2","3" and put them into the proggy in place of the "name@isp.com".
    the part i seem to be missing is proper query and then moving this data into the $mailTo=

    i need some advice on this one.

    thanks ed

  2. #2
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, i think you want to get a list of emails from the db and then email them all


    $result = mysql_result("SELECT email FROM table");
    while($row = mysql_fetch_array($result))
    {
    $email = $row['email'];

    $mailTO = $email;

    // your code for actually sending the mail goes here

    }

    ---------------------------
    SitePoint Moderator
    we eat, live, sleep PHP, do you need a php host?

  3. #3
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    and thanks for the help.

    i will try it in a little while.

    peace ed

  4. #4
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    i have tried the code you sent and it works just fine.

    one of the things i am going to need to do is maintain a level of confidentiality. so i am going back to rework the code and start with a count of the emails in the table, then iterate through, sending the "new entry" message to each of the entries.

    when i submitted the problem to the forum, i did not know that the array would expose all the listings to each member. but i also did not know how to write the code. i can now complete the code with the changes.

    thanks for the help. it is just the thing i needed.

    peace ed


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •