Jump to content

send email from database problem


phppup

Recommended Posts

Follow up question: what would be the best way of sending a final email with a message that would list all IDs that were contacted (in the loop of emails)?

Is there a way to retain and call those IDs? Or do I need a 2nd while statement to re-capture that info again?

Link to comment
Share on other sites

NM - just saw the 2nd page of responses.      Your original code is really really wrong. It's looping through the database results and trying to send an email each time. Then when you're done with your loop you set the headers and message that you used inside your loop to send the e-mails. Try this.  You'll have to put your actual table name in instead of x.  But if you don't get anything from that. Then the problem is the query or $link

$query = "select * FROM x where id > ='210'"; 
$result = mysqli_query($link, $query); 
if(mysqli_num_rows($result) > 0) { 
  while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 
    var_dump($row); 
  }
}

 

Even my limited knowledge has allowed me to have confidence in the db and table that I am using.
I have a separate script with the same or similar connections to the same table and it successfully echoes all variables in a table.
My sense is that there is a disorder in the format of my email or a misplaced } .
Either way it appears that the code is allowing a break in the loop (which actually seems NOT to be looping, but rather only running once(at best).
Sadly, my original code still comes closest to a successful outcome (since it at least Manfred to send one email. LoL

Edited by taquitosensei
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.