Re: Do while loop inside of mail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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='<table width="100%"  border="0">
                 <tr class="style2">
<td width="20%" class="style8"><u>Project Number </u></td>
                   <td width="20%"><u><strong>Start Date</strong></u></td>
                   <td width="26%"><u><strong>Class</strong></u></td>
                   <td width="34%"><u><strong>Location</strong></u></td>
                     </tr></table>
Line 28      'do { .'
                       <tr class="style2">
<td width="20%" class="style8">'.$row_Recordset1['pnumber'].'</td> <td width="20%">'.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).'</td>
                 <td width="26%">'.$row_Recordset1['title'].'</td>
                 <td width="34%">'.$row_Recordset1['location'].'</td>
</tr>'. while } $row_Recordset1 = mysql_fetch_assoc($Recordset1)).'</table>';

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

$message= '
<table width="100%"  border="0">
	<tr class="style2">
		<td width="20%" class="style8"><u>Project Number</u></td>
		<td width="20%"><u><strong>Start Date</strong></u></td>
		<td width="26%"><u><strong>Class</strong></u></td>
		<td width="34%"><u><strong>Location</strong></u></td>
	</tr>
</table>';

do {
	$message .= '<tr class="style2">
		<td width="20%"
		class="style8">'.$row_Recordset1['pnumber'].'</td>
<td width="20%">'.date("m/d/Y", strtotime($row_Recordset1['Sdate'])).'</td>
		<td width="26%">'.$row_Recordset1['title'].'</td>
		<td width="34%">'.$row_Recordset1['location'].'</td>
	</tr>';

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

$message .= '</table>';


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux