Do while loop inside of mail()

Do while loop inside of mail()

am 05.07.2006 23:55:23 von mbomgardner

MySQL 4.1/PHP 4.2

I am trying to generate a email to send to people with a list of events
happening through out the month.

I am pulling the email addresses from the database with no problem, but
when I put the list of events inside of the mail(), it barks at the do
while statment.

Here is the do while code:

$message='







Project Number
Start Date Class Location

Line 28 'do { .'


class="style8">'.$row_Recordset1['pnumber'].'
'.date("m/d/Y",
strtotime($row_Recordset1['Sdate'])).'
'.$row_Recordset1['title'].'
'.$row_Recordset1['location'].'
'. while } $row_Recordset1 =
mysql_fetch_assoc($Recordset1)).'';

And the server response
*Parse error*: parse error in */home/Data/email/test.php* on line *28*

Line 28 is the start of the do while loop

markb

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Do while loop inside of mail()

am 06.07.2006 01:11:10 von Bastien Koert

I don't see you closing the single quote at the end of the statement before
do loop

Bastien


>From: Mark Bomgardner
>Reply-To: mbomgardner@kletc.org
>To: Php-Db
>Subject: [PHP-DB] Do while loop inside of mail()
>Date: Wed, 05 Jul 2006 16:55:23 -0500
>
>MySQL 4.1/PHP 4.2
>
>I am trying to generate a email to send to people with a list of events
>happening through out the month.
>
>I am pulling the email addresses from the database with no problem, but
>when I put the list of events inside of the mail(), it barks at the do
>while statment.
>
>Here is the do while code:
>
> $message='


>
>
>
>
>
>
Project Number
>
Start DateClassLocation

>Line 28 'do { .'
>
> >class="style8">'.$row_Recordset1['pnumber'].' >width="20%">'.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).'
> '.$row_Recordset1['title'].'
> '.$row_Recordset1['location'].'
> '. while } $row_Recordset1 =
>mysql_fetch_assoc($Recordset1)).'';
>
>And the server response
>*Parse error*: parse error in */home/Data/email/test.php* on line *28*
>
>Line 28 is the start of the do while loop
>
>markb
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Do while loop inside of mail()

am 06.07.2006 02:05:32 von Chris

Mark Bomgardner wrote:
> MySQL 4.1/PHP 4.2
>
> I am trying to generate a email to send to people with a list of events
> happening through out the month.
>
> I am pulling the email addresses from the database with no problem, but
> when I put the list of events inside of the mail(), it barks at the do
> while statment.
>
> Here is the do while code:
>
> $message='


>
>
>
>
>
>
Project Number
>
Start DateClassLocation

> Line 28 'do { .'
>
> > class="style8">'.$row_Recordset1['pnumber'].'
> '.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).'
> '.$row_Recordset1['title'].'
> '.$row_Recordset1['location'].'
> '. while } $row_Recordset1 =
> mysql_fetch_assoc($Recordset1)).'';

Before anything else, a "helpful hint". Make your code cleaner, it will
be easier to work out whats going on:

$message= '







Project Number Start Date Class Location
';

do {
$message .= '
class="style8">'.$row_Recordset1['pnumber'].'
'.date("m/d/Y",
strtotime($row_Recordset1['Sdate'])).'
'.$row_Recordset1['title'].'
'.$row_Recordset1['location'].'
';

} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));

$message .= '';


which one is easier to read and debug?

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php