Page 1 of 1

Parse query results into the email message

Posted: Sat Jan 14, 2012 3:02 am
by nita
Hi

I have a problem with parsing a query into the email message. Where messege shuld be a complete resoult of a query.

Please take a look on code below:

Code: Select all

$message = "\r\n" .
                    'Here are the details of your order:' . 
                    '<br><br><table><tr><td>Name</td><td>Amount</td><td>Unit</td><td>Price</td><td>Total</td></tr>' . "\r\n";

/// till here is fine
			
$result2 = mysql_query("SELECT * FROM orderslist WHERE supplier='$supplier'") or die(mysql_error());
		$data = array();
		$data['' . $row2['id']] = $_POST['' . $row2['id']];
		$value = $_POST['' . $row2['id']];
		
		while($row2=mysql_fetch_array($result2))
		{
			$value = $_POST['' . $row2['id']];
		if ( $value == ""){
		 
		} 
		else {
		$total = $value * $row2['price'];	

/// this part below i have a problem with do not now how to join this part with the top part ($message)

		echo "
		<tr>
	    <td class='H4'><strong>$row2[name]</strong></td>
		<td class='H4' align='center'>$value</td>
		<td class='H4'>$row2[unit]</td>
		<td class='H4'>$row2[price]</td>
		<td class='H4'>$total</td></tr>";
		}
 }
	echo "</table>";

I think that has something to do with "\r\n" and dots, but i do not get that fully. If someone could help me on this one will be gratefull.

Thank you very much in advance.

Re: Parse query results into the email message

Posted: Sat Jan 14, 2012 3:24 am
by nita
I found solution for my problem ... so easy ...

$message = " 1 part";
$message .= "2 part";