Re: mail() while() loop
| From: | David Robley | Date: | Thu, 06 Jul 2000 01:46:57 +0000 |
| Subject: | Re: mail() while() loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5142@lists.php.net to get a copy of this message | ||
On 5 Jul, Eric Porter wrote:
> I want to send all the results of a
> query/calculation in a single email to a user.
> I know the syntax for the mail function.
> But how do I get all the rows from the results of
> the query into a single email.
> $list = mysql_query("select * from products
> order by name ASC");
> while ($row = mysql_fetch_array($list)) {
> do somethings }
>
> Put the while inside of the email() ?
>
> Thanks
> eric
while ($row = mysql_fetch_array($list)) {
do somethings
add somethings to variable}
Then mail the variable as the message body. You may have to do a bit of
formatting with \n to break lines as required.
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA