Jump to content

Parse query results into the email message


nita

Recommended Posts

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:

 

$message = "\r\n" .
                    'Order details:' . 
                    '<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.

 

You have a variable:

 

$message = "
some stuff
and more 
and more";

 

Now you want to add more to the string, you can do ...

 

$message = $message . "more things added to message";

 

or you can do:

 

$message = "$message more things added to message";

 

or, what most people do, which is a shorthand for the first concatenation:

 

$message .= "More things added to message";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.