Jump to content

Mail message depends on nr of people.


wannes

Recommended Posts

My apologize if this should be here since this involves SQL.

 

My user can register himself ( just an email ) to a mail list.

He will get a mail after that, but the message in the mail should differ:

If there are under 100 people in the DB he should get something like " you are one of the 100 first people ", if there are more then 100 people it should say " sorry, to late ".

 

I can seem to get it to work so help would be awesome

( ps, I kinda need an anwser fast :s )

$sqlInsert = "INSERT INTO j5_maillist (email) VALUES('$email')";

        $sql = "SELECT COUNT(email) FROM j5_maillist AS aantalEmails";
        $result = mysql_query($sql);


        if( mysql_num_rows($result) <= "3" ){
             $message = 'you are one of the 100 first people  ';
    } else {
             $message = 'sorry, to late  ';
}

        $to      = $email;
        $subject = 'Nihonto Appreciation Day';
        $headers  = 'MIME-Version: 1.0' . "\r\n";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

            // Additional headers
        $headers .= 'To: '.$email.'' . "\r\n";
        $headers .= 'From: Nihonto Appreciation Day' . "\r\n";

        mail($to, $subject, $message, $headers);

        return mysql_query($sql);

 

Link to comment
Share on other sites

You set if count = or less than three it would let him register

 


<?        $sql = "SELECT COUNT(email) FROM j5_maillist AS aantalEmails";
        $result = mysql_query($sql);


        if( mysql_num_rows($result) <= "3" ){
             $message = 'you are one of the 100 first people  ';
    } else {
             $message = 'sorry, to late  ';
}
?>

 

You should set that to 100

 

if( mysql_num_rows($result) <= "100" ){

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.