title: I need to retrieve rows in database then email that list
body: <p>How can I retrieve rows from database then use a <code>mail()</code> function to then email that list in my php file.</p>
  
  <p>The query that I am using which this works:</p>
  
  <pre><code>$sql = "SELECT * FROM leads WHERE date_stamp BETWEEN '$currentdate' - INTERVAL 7 DAY AND '$currentdate'";`
  </code></pre>
  
  <p>But the problem I am having is listing out all the data to then email, I am only getting the one result from database, but not all the rows. I know its the way my loop is setup, that is what I am needing help with.</p>
  
  <p>Below is the full code minus the database connect.</p>
  
  <pre><code>$to = 'email@email.com';
  
  // email subject     
  $subject = 'Email leads beginning '.$newdate." through ".$currentdate;
  
  // Construct email body     
  $result = mysqli_query($conn, $sql);
  $recipients = array();
          while($rows = mysqli_fetch_assoc($result)) {
              foreach ($result as $row) {
                  $content = $row['first_name']." ".$row['last_name']."&lt;br&gt;";
          }
              };
  
  $body_message = $content;
  
  // email headers     
  $headers = 'From: ' . $email_from . "\r\n";
  $headers .= "Content-type: text/html\r\n";  
  
  mail($to, $subject, $body_message, $headers);
  </code></pre>