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 7069239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:25:18+00:00 2026-05-28T05:25:18+00:00

I have a php page which displays class schedule data for each user from

  • 0

I have a php page which displays class schedule data for each user from mysql database like this:

$result = mysql_query($sql);

echo "<table border='0'>
<thead>
    <tr>
        <th>Class Link</th>
        <th>Student Skype ID</th>
        <th>Student Name</th>
        <th>Faculty Name</th>
        <th>Class Name</th>
        <th>USA Date (DD/MM/YY)</th>
        <th>USA Start Time</th>
        <th>USA End Time</th>
        <th>India Date (DD/MM/YY)</th>
        <th>India Start Time</th>
        <th>India End Time</th>
        <th>Status</th>
    </tr>
</thead>";

while($row = mysql_fetch_array($result))
{
    echo "<tbody>";
        echo "<tr>";
            echo "<td><a href=\"".$row['class_link']."\" target='blank'>Start Class</a></td>";
            echo "<td>" . $row['skype_id'] . "</td>";
            echo "<td>" . $row['student_name'] . "</td>";
            echo "<td>" . $row['faculty_name'] . "</td>";
            echo "<td>" . $row['subject_name'] . "</td>";
            echo "<td>" . $row['date'] . "</td>";
            echo "<td>" . $row['starttime'] . "</td>";
            echo "<td>" . $row['endtime'] . "</td>";
            echo "<td>" . $row['facdate'] . "</td>";
            echo "<td>" . $row['facstarttime'] . "</td>";
            echo "<td>" . $row['facendtime'] . "</td>";
            echo "<td>" . $row['status'] . "</td>";
    echo "</tr>";
    echo "</tbody>";
}
echo "</table>";

now i have the following php email script

$to = 'support@xyz.com';
$subject = "Your Class Schedule";
$message = **'HOW CAN I PUT THE DATA FROM MYSQL HERE?'**;
$headers = 'From: REPLY@XYZ.COM' . "\r\n" .
$headers = "MIME-Version: 1.0" . "\r\n" .
$headers = "Content-type:text/html;charset=iso-8859-1" . "\r\n" .
            'Reply-To: REPLY@XYZ.COM' . "\r\n" .
           'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

As mentioned in the $message of the above code i would like to put this retrieved data into the $ message section so that it goes in the mail..

can anyone help?

  • 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-28T05:25:18+00:00Added an answer on May 28, 2026 at 5:25 am

    depending on the source of your mysql data and how it is stored can’t you retrieve it and just add it to the $message variable?

    <?PHP
        $query = "SELECT * FROM yourtable WHERE youridentifier = 'unique'"
        $result = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($result)) {
            $content = $row['field with email content']
            // or if there is more than one field
            $content2 = $row['field with more email content']
        }
        // then you can create the "message" as you wish
        $message = "Greetings ".$content.",
    
            you are receiving this email because of blah. ".$content2."
    
            Thank you,
            code guy"
        // Then you can still use $message as your variable
    }
    ?>
    

    format it as you with (HTML or not, etc) .. and mail away.

    for multiple rows change the while up a little..

    <?PHP
        // give your message the starting string
        $message = 'Greetings,
    
            you are receiving this email as an invoice as follows:
            <table style="width: 80%;">
                <tr>
                    <td>Description</td>
                    <td>Cost</td>
                    <td>Weight</td>
                    <td>Color</td>
                </tr>
        '
        $query = "SELECT * FROM yourtable WHERE youridentifier = 'unique'"
        $result = mysql_query($query) or die(mysql_error());
        while ($row = mysql_fetch_array($result)) {
            $message .= "        <tr>";
            $message .= "            <td>".$row['itemdescription']."</td>";
            $message .= "            <td>".$row['cost']."</td>";
            $message .= "            <td>".$row['shippingweight']."</td>";
            $message .= "            <td>".$row['color']."</td>";
            $message .= "        </tr>";
        }
        // then update the message with the ending
        $message .= "
            </table>
    
            Thank you,
            code guy"
        // Then you can still use $message as your variable
    }
    ?>
    

    That pressumption is if you are using HTML formatted emails, otherwise it’ll just be formatted text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php page that displays rows from a mysql db as a
I coded a php page that displays information from a mysql database neatly into
I have web page in PHP which displays all records in a table. I
I have a PHP-generated page which is displaying some data about a set of
We have an existing PHP page (from an earlier project) which could be described
SOLVED: Error in template file I have Smarty setup like this: require_once 'smarty/Smarty.class.php'; $smarty
I have a page which brings database entries in and displays them, and i
I have a table created with PHP from an Sql Database that successfully displays
I currently have a page defined which displays some data in rows. At the
I have the following in a .htaccess file redirect 301 /page.php http://domain.com/page Which works

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.