CasinoAl
CasinoAl

Reputation: 1

Line breaks in PHP email from mySQL

I have the following code that works - apart from not splitting into separate lines for each result.

<?php>

$result = mysql_query("SELECT * FROM lending");
 //fetch the data from the database 
$entries = 'Entries: '; 
while ($row = mysql_fetch_array($result)) {
$entries .= $row['bookname'] . ', "/r"';
}
{
?>

// In case any of our lines are larger than 70 characters, we should use wordwrap()
//$entries = wordwrap($entries, 70, "\r\n");

// Send
mail('[email protected]', 'My Subject', $entries);
?>

When I run this I get an email looking like this:

Entries: Test ASIN, "\r"Test ASIN, "\r"Test ASIN, "\r"Test ASIN, "\r"Test ASIN, "\r"The Expectant Father: Facts, Tips, and Advice for Dads-to-Be, "\r"Animal Farm, "\r"Hornet flight, "\r"

Where should I put the "/r" to have it parsed properly? Or should it be "/n/r"?

thanks!

Alex

Upvotes: 0

Views: 48

Answers (1)

dricket
dricket

Reputation: 386

It looks like the code has /r instead of \r.

Upvotes: 1

Related Questions