Results 1 to 2 of 2

Thread: Admin Send

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Admin Send

    how do I get this to send to all people on my sql database!!

    PHP Code:

    <?php
    mysql_connect 
    (localhostuserpass); 
    mysql_select_db (nz);  



    if (
    $action == "save"


    $result mysql_query ("SELECT name, email, id FROM warriors_note ord id");

    $to "$email"
    $subject "Warriors Supporters Site Membership"
    $body "$name"
    $headers "From: Warriors.Rleague.Com<mailto:[email protected]>\n"
    $headers .= "From: Feedback \n"
    $headers .= "X-Sender: <[email protected]>\n"
    $headers .= "X-Mailer: PHP\n"// mailer 
    $headers .= "Return-Path: <[email protected]>\n"// 

    $message "Hi $name, thanks for registering your interest with our site. We will let you know once the site has opened for full memberships."
    $message .= "\n\n"

    mail($to,$subject,$message,$headers); 
    echo 
    "Sent!"

    }else{ 
    ?> 

    <form method="POST" action="noteadmin.php?action=save"> 
     <input type="hidden" name="action" value="save"/> 
     <p>Subject:<input type="name" name="suibject" size="20"></p> 
    <p>Body:<textarea rows="10" name="body" cols="50"></textarea>

    </p> 


    </p> 
    <input type="submit" value="Register" name="B1"></

    </form> 
    <?php 

    ?>
    Last edited by kiwis; Apr 4th, 2004 at 09:56 PM.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    You need to obtain a recordset of all the users in your table and send an e-mail separatley to each one.
    PHP Code:
    <?php
    @mysql_connect (localhostuserpass) or die('Error connecting'); 

    @
    mysql_select_db (nz) or die ('database error');  

    (
    $result = @mysql_query ("SELECT name, email FROM warriors_note;")) or
      die (
    'query error');


    /* loop through each row and send the e-mail */
    while ($row mysql_fetch_assoc ($result) {
        
    $to "{$row['name']} <{$row['email']}>"
        
    $subject "Subject goes here"

        
    $headers "custom: headers\n"

        
    $message "Put message here"
        
    $message .= "\n\n"

        
    mail($to,$subject,$message,$headers); 
    }
    ?>
    Last edited by visualAd; Apr 5th, 2004 at 03:03 AM.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width