Click to See Complete Forum and Search --> : Format My Outputted Data From PHP


tomyknoker
04-15-2007, 09:14 PM
I am trying to format the data that is pulled from my database, but aren't having much luck. By putting my ';' on the following line it has managed to put each new query on a seperate line, but I want to bold some of the headings and also put the 'Name' on a line by itself... What am I doing wrong?

else {

while ($qry = mysql_fetch_array($results)) {
if (strtotime($qry['loginDateTime']) <= (time() + 86400*31)) {
$login .= ' <strong>Name</strong><br> '.$qry["FirstName"].' '.$qry["LastName"].' Application Date:'.date("d/m/Y", strtotime($qry["JoinDate"])).' '.$qry["Email"].' '.$qry["rep_Firstname"].' '.$qry["rep_Lastname"].' ('.$qry["State"].')
--------------------
';
}
}

$message = <<<HERE
The login information is as follows:
-----------------------------------------

$login
HERE;

$from = "me@mydomain.com";

mail($to, $subject, $message, 'From: '.$from);
}

MrCoder
04-15-2007, 09:37 PM
If you want to have HTML in your mail you need to send the mail as a MIME e-mail.

tomyknoker
04-15-2007, 09:38 PM
Oh ok so will I need to change the entire way I have set this file up?

MrCoder
04-15-2007, 09:49 PM
Not really but there is a lot of ground work to do before you get the hang of MIME formatting.

Most people are more at home with something like PHPMailer (http://phpmailer.sourceforge.net/).

tomyknoker
04-15-2007, 10:00 PM
Bummer I just wanted to keep this nice and simple, can I atleast put some of the info on a new line?

MrCoder
04-16-2007, 03:24 AM
Use "\r\n" to add newlines.


echo "This is the first line\r\nThis is the second line";