Re: mailing forms and input into MySQL
| From: | Kevin Stone | Date: | Wed, 02 Apr 2003 20:07:28 +0000 |
| Subject: | Re: mailing forms and input into MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142021@lists.php.net to get a copy of this message | ||
There is no trick to it. Query the database, build a string, send it off.
<?
$query = "SELECT * FROM mytable";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
foreach ($row as $column => $value)
{
$body .= "$column : $value\n";
}
$body .= "\n";
}
mail($to, $subject, $body, $headers);
?>
HTH,
Kevin
----- Original Message -----
From: "Scott Miller" <srmiller@interbel.net>
To: <php-general@lists.php.net>
Sent: Wednesday, April 02, 2003 12:05 PM
Subject: [PHP] mailing forms and input into MySQL
Hi all,
I have a current php script that allows me to add/remove customer
information from a particular MySQL Database. What I would like to do, is
when an employee adds a customer, have some (if not all) of that information
e-mailed to a particular e-mail address.
I've created scripts that e-mail info, and ones that just enter info into
a database, but have not attempted combining them.
Anyone have any ideas, or is anyone doing this? If so, could you give me
a quick how-to or point me in the direction of some online documentation?
Thanks,
Scott Miller