php formating html table cell

I need some help with formatting a HTML table cell in an HTML email created in a php script. What I want is a list of number aligned in the table cell vertically. What I get is a list of numbers  all in one line in the cell.

// email.
    $to = "";
    $from = "";
    $subject = "Hello! This is HTML email";

    //begin of HTML message
$message ='<html>
  <body bgcolor="#DCEEFC">
        <b> I am reciving HTML email......</b> <br>
        <font color="red">Thanks !</font> <br>
      <table border="1">
<td >';
 while ($line =  mysql_fetch_assoc($result)) {
     	$message .=    $line['num']. " \n";
$message.= '</td>


   //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    // now lets send the email.
    mail($to, $subject, $message, $headers);

    echo "Message has been sent....!";

Open in new window

Who is Participating?
bartvdConnect With a Mentor Commented:
You should replace this line:
$message .=    $line['num']. " \n";

in this line:
$message .=    $line['num']. "<br />";
HainKurtSr. System AnalystCommented:
you can also use <li>

$message .=    "<li>" .$line['num'];
stu215Connect With a Mentor Systems AnalystCommented:
-> you can also use <li>
-> $message .=    "<li>" .$line['num'];

Dont forget to close the <li>...</li> ::

$message .=    "<li>".$line['num']."</li>";
HainKurtConnect With a Mentor Sr. System AnalystCommented:
actually we should include <ol>...<ol> or <ul>...</ul> too :)

$message.= '<ul>';
while ($line =  mysql_fetch_assoc($result)) {
  $message .=    "<li>".$line['num']."</li>"." \n";
$message.= '</ul>';

for lines: 18-22
pointhighAuthor Commented:
This worked great! Thanks!
I tested everyone’s solution and they all worked. Bartvd solution was the closest to what I was looking for.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.