Jump to content

SuiGenerisMN

New Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SuiGenerisMN

  • Rank
    Newbie
  1. SuiGenerisMN

    Emails are being combined

    mac_gyver, Agree with the DB labeling, I modified the code for example but the actual labels are meaningful. Duplicating the code is perhaps redundant, but it is separating the messages as desired. The issue, even if I remove the redundant coding, is that both messages for two recipients are being placed on the same email and being sent to both emails. The email would be even more ugly if I had 50 users with the same Yes/Yes or Yes/No combination. But again, the Yes/Yes message and Yes/No message are not being combined, it is only the users with the same combination. I just can't figure out, or find, how to say: "Send email with only user 1 message to user 1" stop "Send email with only user 4 message to user 4" stop
  2. SuiGenerisMN

    Emails are being combined

    ginerjm, The two separate messages are not being combined, but rather the same message to multiple recipients. And the message is being placed in all emails of that set parameter. Right now I have 4 records in the DB. User 1 - Yes/Yes User 2 - Yes/No User 3 - No/Yes User 4 - Yes/Yes With the script, User 3 should not get a message; User 2 should get a different message than User 1 and User 4. The issue is User 1 and User 4 should get the same message, but in their own email; what is happening is their individual messages are being combined into a single email and sent to both email addresses. Both emails look the same such as: Hello User 1, Thanks for checking us out on X day; glad you chose product ABC to review. Have a great day, This company Hello User 4, Thanks for checking us out on Y day; glad you chose product TUV to review. Have a great day, This company What I want is these emails to be separated; and sent only to the user's email that is in the greeting. Hope that provides more clarification.
  3. SuiGenerisMN

    Emails are being combined

    Hey again, hopefully this is a bit less beginner than my previous issue but I will likely find out not. I am writing a php page to send an email reminder to a list in a MySQL database. I want two separate email messages based on whether two of the columns in the database are yes/yes or the second email message if yes/no and no email message if yes/(yes or no). This is not the issue as I have the following in two separate parts of php. This is appropriately selecting which 'users' to send emails to and which message. Right now I am only testing the DB and don't have any real data loaded yet. My issue is when I have 2+ users with the same set up combination (Yes/Yes) or (Yes/No) that the email message is 1) same message is being sent to both emails 2) the messages are being combined Example User 1 - email Hi User 1, Welcome to the web From Me Hi User 2, Welcome to the web From Me User 2 - email Hi User 1, Welcome to the web From Me Hi User 2, Welcome to the web From Me I can't figure out how to separate the messages to the different users and ensure the right information is sent to the right user. <?php $servername = "localhost"; $username = ""; $password = ""; $dbname = ""; $tblname = ""; $conn = mysqli_connect($servername, $username, $password, $dbname) or die("Unable to Connect to '$dbhost' - Please email support@domain.com"); $sql = "SELECT * FROM $tblname WHERE item1='No' AND item2='Yes'"; $result = mysqli_query ($conn, $sql) or die ('Error querying database. 1'); while($row = mysqli_fetch_array($result)){ $first_name = $row['First']; $last_name = $row['Last']; $stuff1 = $row['Stuff1']; $stuff2 = $row['Stuff2']; $stuff3 = $row['Stuff3']; $email_to = $row['Email']; $email_from = "support@domain.com"; $email_subject = "Subject 1"; $email_message .= "Hello $first_name $last_name,\n"; $email_message .= "\n"; $email_message .= "Message\n"; $email_message .= "\n"; $email_message .= "Message\n"; $email_message .= "\n"; $email_message .= "Message\n"; $email_message .= "\n"; $email_message .= "Message\n"; $email_message .= "Message\n"; // create email headers mail($email_to, $email_subject, $email_message, 'From:' . $email_from); echo 'Email sent to: ' . $email_to. '<br>'; } mysqli_close($conn); ?> <?php $servername = "localhost"; $username = ""; $password = ""; $dbname = ""; $tblname = ""; $conn = mysqli_connect($servername, $username, $password, $dbname) or die("Unable to Connect to '$dbhost' - Please email support@domain.com"); $sql = "SELECT * FROM $tblname WHERE item1='Yes' AND item2='Yes'"; $result = mysqli_query ($conn, $sql) or die ('Error querying database. 2'); while($row = mysqli_fetch_array($result)){ $first_name2 = $row['First']; $last_name2 = $row['Last']; $stuff12 = $row['Stuff1']; $stuff22 = $row['Stuff2']; $stuff32 = $row['Stuff3']; $email_to2 = $row['Email']; $email_from = "support@domain.com"; $email_subject2 = "Subject 2"; $email_message2 .= "Hello $first_name2 $last_name2,\n"; $email_message2 .= "\n"; $email_message2 .= "Message2\n"; $email_message2 .= "\n"; $email_message2 .= "Message2\n"; $email_message2 .= "\n"; $email_message2 .= "Message2\n"; $email_message2 .= "\n"; $email_message2 .= "Message2\n"; $email_message2 .= "Message2\n"; // create email headers mail($email_to2, $email_subject2, $email_message2, 'From:' . $email_from); echo 'Email sent to: ' . $email_to2. '<br>'; } mysqli_close($conn); ?>
  4. SuiGenerisMN

    Another, sigh, "unexpected end of file" error

    Thank you kicken, that solved the errors completely. Crazy I missed that piece. Appreciate it.
  5. I am sure to get some flack for this, but I have searched google, and this forum, and found some great advice, but I am still getting the "unexpected end of file" error. Any assistance is appreciated. Background, I have an HTML form that submits an email to me and I would also like to send the form data to a DB. The emailform.php has the include ("loaddb.php"); at the top. The emailform.php works fine, but the data never gets entered into the DB. <?php $servername = “localhost”; $username = “”; $password = “”; $dbname = “”; $tblname = “”; If (isset($_POST[‘submit’])) { $conn = mysqli_connect($servername, $username, $password); if (!$conn) { die('Could not connect: ' . mysqli_error()); } mysqli_select_db($dbname, $conn); $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $email_from = $_POST['email']; $telephone = $_POST['telephone']; $first_name = mysqli_real_escape_string($first_name); $last_name = mysqli_real_escape_string($last_name); $email = mysqli_real_escape_string($email); $telephone = mysqli_real_escape_string($telephone); $query = " INSERT INTO $dbname.$tblname(‘ID’, ‘First’, ‘Last’, ‘Email’, ‘Phone’) VALUES (NULL, '$first_name', '$last_name', '$email', '$telephone');”; } mysqli_close($conn); ?> I checked whitespace, all brackets appear to be closing. Error shows as last line with the closing "?>" and I am stumped. Again, sorry for "another one of these error" questions but I just cannot get this to work and have been trying everything I can think of.
×

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.