|
-
Nov 26th, 2007, 07:32 AM
#1
Thread Starter
New Member
How to get an email with multiple records form MySQL displayed using php?
Hi,
Could you pls tell me how to get an email with multiple records form MySQL displayed using php?
Suppose, I have 10 fields in a table. and have 25 records. I want to make an email in HTML format which makes query to db and then send s me an email displaying these all 25 records one below the other.
P.S.: Single record are displayed properly. but the multiple records - the while loop is been used. Thanks
this is my code
PHP Code:
if($nume>=1)
{
while($row=mysql_fetch_array($query))
{
$location=$row["loc_ville"]."[".$row["loc_codepostal"]."]";
$surface=$row["surface"];
$montant=$row["montant"];
$pieces=$row["pieces"];
$description=$row["description"];
$chambres=$row["chambres"];
$ids=$row[0];
}
}
$message = "<html>
<head>
<title>mail temp</title>
</head>
<body>
<div align='center'>
<table border='0' cellpadding='0' cellspacing='0' width='600'>
<tr>
<td>
<table border='0' cellpadding='0' cellspacing='0' width='600'>
<tr>
<td><img src='http://www.agencymmo.com/images/mail_banner1.jpg' width='329' height='137' alt='' border='0'></td>
<td><img src='http://www.agencymmo.com/images/mail_banner2.jpg' width='287' height='137' alt='' border='0'></td>
</tr>
<tr>
<td colspan='2'>
<table border='0' cellpadding='0' cellspacing='0' width='600'>
<!--DWLayoutTable-->
<tr>
<td width='28'><img src='http://www.agencymmo.com/images/mail_left_top.jpg' alt='' border='0' height='22' width='28'></td>
<td width='558' background='http://www.agencymmo.com/images/mail_top_line.jpg'> </td>
<td width='28'><img src='http://www.agencymmo.com/images/mail_rite_top.jpg' alt='' border='0' height='22' width='28'></td>
</tr>
<tr>
<td height='402' background='http://www.agencymmo.com/images/mail_left_vert.jpg'></td>
<td >
<table border='0' cellpadding='0' cellspacing='0' width='558'>
<!--DWLayoutTable-->
<tr>
<td width='558' height='399' >
<table border='0' cellpadding='0' cellspacing='0' width='558'>
<!--DWLayoutTable-->
<tr>
<td width='558'>
<table border='0' cellpadding='0' cellspacing='0' width='558'>
<tr>
<td align='right' height='30'><span class='s2'>Your login name</span> : <span class='s1'>$email.</span></td>
</tr>
<tr>
<td><p class='line'><span class='s1'>Dear customer,</span><br>
Thanks
for contacting agency mmo. And here with your annon details are sent
with complete information.The annon is available on [url]www.agencymmo.com.pls[/url]
contact.</p></td>
</tr>
<tr>
<td height='10'></td>
</tr>
</table> </td>
</tr>
<tr>
<td height='40'>
<table border='0' cellpadding='0' cellspacing='0' width='558'>
<tr>
<td class='s4' background='http://www.agencymmo.com/images/mail_button_bg.jpg' width='140'> Matched annonces</td>
<td><img src='http://www.agencymmo.com/images/mail_button_edge.jpg' alt='' border='0' height='23' width='32'></td>
<td background='http://www.agencymmo.com/images/mail_button_line.jpg' width='390'> </td>
</tr>
</table> </td>
</tr>
<tr>
<td height='97' >
<table border='0' cellpadding='0' cellspacing='0' width='558'>
<!--DWLayoutTable-->
<tr>
<td width='10' height='19'> </td>
<td class='s1' width='170'>Location</td>
<td align='center' width='11'>: </td>
<td class='line' width='100'>.$location.</td>
<td width='10'> </td>
<td class='s1' width='143'><div align='right'><a href='http://www.agencymmo.com/emaildetalisannounce.php?id=$ids&ids=$id' class='link9'>Fiche Complete</a></div></td>
<td width='12'> </td>
</tr>
<tr>
<td height='19'> </td>
<td class='s1'>Prixs</td>
<td align='center'>: </td>
<td class='line'>$montant</td>
<td> </td>
<td> </td>
</tr> <tr>
<td height='19'> </td>
<td class='s1'>Surfaces</td>
<td align='center'>: </td>
<td class='line'>$surface</td> <td> </td> <td> </td> </tr> <tr> <td height='19'> </td> <td class='s1'>Nb. of pieces</td> <td align='center'>: </td> <td class='line'>$pieces</td> <td> </td> <td> </td> </tr> <tr> <td height='19'> </td> <td class='s1'>Chambers</td> <td align='center'>: </td> <td class='line'>$chambres</td> <td> </td> <td> </td> </tr> <tr> <td height='19'> </td> <td class='s1'>Description</td> <td align='center'>: </td> <td class='line'>$description</td> <td> </td> <td> </td> </tr> </table></td> </tr>
<tr> <td height='26' valign='top'> <table border='0' cellpadding='0' cellspacing='0' width='558'> <tr>
<td background='http://www.agencymmo.com/images//mail_button_line.jpg' border='0' height='' width='390'> </td>
<td background='http://www.agencymmo.com/images//mail_button_line.jpg' width='390'> </td>
</tr>
</table></td>
</tr>
<tr>
<td height='2' valign='top'><hr color='#bda738'></td>
</tr>
<tr>
<td height='29' valign='top'><p class='line' align='center'>
Please save this email ID to ensure that all communication from agencymmo to reaches you!</p></td>
</tr>
<tr>
<td height='27' align='center' valign='top'><span class='line'>Copy right agency mmo</span> <a href='#' class='ref1'>www.agencymmo.com</a></td>
</tr>
<tr>
<td height='2'></td>
</tr>
</table></td>
</tr>
<tr>
<td height='3'></td>
</tr>
</table></td>
<td background='http://www.agencymmo.com/images//mail_rite_vert.jpg'></td>
</tr>
<tr>
<td height='25' valign='top' background=''><img src='http://www.agencymmo.com/images/mail_left_bot.jpg' ' border='0' height='22' width='28'></td>
<td valign='top' background='http://www.agencymmo.com/images/mail_bot_line.jpg'><!--DWLayoutEmptyCell--> </td>
<td valign='top' ><img src='http://www.agencymmo.com/images/mail_rite_bot.jpg' alt='' border='0' height='22' width='28'></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</div>
</body>
</html>";
$subject ="Votre compte Announce a été créé";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: Agencymmo.com<[email protected]>\r\n";
$headers .= "Reply-To:[email protected]\r\n";
mail($email, $subject, $message, $headers);
?>
Last edited by penagate; Nov 26th, 2007 at 08:16 AM.
Reason: added code tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|