Sending plain text data in a table with mail()

From: Date: Fri, 31 Jan 2003 03:17:28 +0000
Subject: Sending plain text data in a table with mail()
Groups: php.general 
Request: Send a blank email to php-general+get-133733@lists.php.net to get a copy of this message
Greetings, I am having trouble with the following code. I am trying to make a table in plain text to send via email. I get the data frm a MYSQL table and then put it into an array. I find the max strlen and subtract each individual customer name strlen from that and add that many spaces. Such that if Max was 10 and a particular one was 3 it would add 7 spaces. It works fine most of the time but my customer fwd me an email where it wasnt. Can someone suggest a better way? I wonder if I have the cart in front of my horse but Im not sure of any better way. I appreciate any help. Thanks, Leonard. www.phpna.com //Get data from tables if ($result[1]) { while ($row = mysql_fetch_array($result[1])) { $cust = $row["customer"]; $cust = get_acct_names($cust, customer); $data[$z][cust]=$cust; $data[$z][strlen]=strlen($cust); //Get longest customer string if ($data[$z][strlen] > $data[1][$z-1][strlen]) { $maxstrlen=strlen($cust); } $data[$z][date]=the_big_date($row["date"], "/"); $data[$z][amount]="$".number_format($row["amount"], 2); $z++; } mysql_free_result($result[1]); } $msg[$i]="Revenue for $mon $yr\n"; $i++; for ($y=0; $y < $z; $y++) { //Find String Length Difference $deltastr = $maxstrlen - $data[$y][strlen]; $cust_str .= repeater(" ", $deltastr); $cust = $data[$y][cust].repeater(" ", $deltastr); $msg[$i]=$data[$y][date]."\t\t".$cust."\t\t".$data[$y][amount]."\n"; $i++; } Leonard.

« previous php.general (#133733) next »