Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:55:45+00:00 2026-05-27T17:55:45+00:00

This is working just fine on a single page. It gives me all information

  • 0

This is working just fine on a single page. It gives me all information I need. But I want to send an email with it. Although I couldn`t figure out how can I do it

$db = new mysqli('localhost', 'root', '', 'panel');
$sql = "select * from detail";
$read = $db->query($sql);

<table style="border:0;width:600px;">
  <tr>
    <td width="50px">Who</td>
    <td width="150px">Time</td>
    <td width="300px">What</td>
  </tr>
<?php 
while($wr = mysqli_fetch_array($read)) {
 echo' <tr>
    <td>'.$wr['Who'].'</td>
    <td>'.$wr['Time'].'</td>
    <td>'.$wr['What'].'</td>
  </tr> ';
}


?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:55:45+00:00Added an answer on May 27, 2026 at 5:55 pm

    You need to buffer all of the HTML you’re generating (which means not sending it to the browser but to accumulate it in a buffer) and send that buffer to the user as email like this:

    // Start buffering
    ob_start();
    // Generate HTML just like you're doing now
    echo( "<html><body><table><tr><td></td></tr></table></body></html>" );
    // Get the contents of the buffer
    $html = ob_get_contents();
    // Stop the buffering
    ob_end_clean();
    
    // Now use the content string you have to send an email just like the example at:
    // http://il.php.net/manual/en/function.mail.php
    
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'To: to@domain.com' . "\r\n";
    $headers .= 'From: from@domain.com' . "\r\n";
    
    mail( "to@domain.com", "This is the subject", $html, $headers );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to get this working but for some reason it's just not right.
I've been working very long on trying to straighten this out, but I just
I've set up a simple, single-service server which has been working just fine with
I have single table inheritance working just fine for my app. I have two
I have been working on this for some time now and just cant quite
I am working with zend just recently. I discovered this ViewScript decorator for form
I just discovered this component and started working with it. I understand that the
I am working on const-correctness of my code and just wondered why this code
I'm currently working on a critical monthly Accounts payable report. This report i just
Okay, this is just a minor caveat. I am currently working with the lovely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.