Jump to content

Parse query results into the email message


nita
 Share

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.

 

Link to comment
Share on other sites

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";

 

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.