Re: E-Mail an HTML table?

From: Date: Mon, 26 Jun 2000 22:08:26 +0000
Subject: Re: E-Mail an HTML table?
Groups: php.general 
Request: Send a blank email to php-general+get-3220@lists.php.net to get a copy of this message
Instead of ECHOing to the screen, you could place the results into a variable. You could then echo that variable and then email the results to a person, assuming their email client can support html. You may also need to adjust the email headers to specifically say that it is html. $html .= "<table border=1>\n"; $html .= "<tr><td>"; $html .= sprintf("%d",foo); // process rest of html // ... echo $html; mail("user@domain.com","subject",$html,$headers); -- Matthew Leverton - matthew@aeroinc.net - http://www.allegro.cc -----Original Message----- From: Gene Cronk <gcronk@sacsgroup.com> To: php-general@lists.php.net <php-general@lists.php.net> Date: Monday, June 26, 2000 5:04 PM Subject: [PHP-GENERAL] E-Mail an HTML table? >The following code creates a table from a database.....how would I put other >code in to mail this table to someone else? > > > ><html> ><body> ><?php > > $db=mysql_connect("host","user","passwd"); > mysql_select_db("mydb",$db); > $result=mysql_query("SELECT * FROM $table ORDER BY name",$db); > > if ($myrow=mysql_fetch_array($result)) { > echo "<table border=1>\n"; > echo > "<tr><td>Name</td><td>RegHours</td><td>IncHours</td> > <td>IncRate</td><td>OTHours</td><td>VacHours</td> > <td>HolHours</td><td>TtlHours</td></tr>"; > do { > > printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td> > <td>%s</td><td>%s</td><td>%s</td><td>%s</td> > </tr>\n", $myrow["name"], $myrow["reg_hours"], > $myrow["inc_hours"], $myrow["inc_rate"], > $myrow["ot_hours"], $myrow["vac_hours"], > $myrow["hol_hours"], $myrow["total_hours"]); > > } while ($myrow=mysql_fetch_array($result)); > > echo "</table>\n"; > >} else { > echo "Sorry, no records found."; > >} >?> ></body> ></html> > > > >Gene Cronk >Asst. MIS >SACS Group - Jacksonville, FL >gene.cronk@sacsgroup.com >904-237-8793 > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#3220) next »