jakebur01 Posted March 14, 2011 Share Posted March 14, 2011 I am generating a few different reports through mysql querys and displaying tables. I have a mail script that stores html code into a variable called $message. How can I store all of my queried data into the variable $message? Example of one of the three tables I am displaying and I am wanting to store this whole table into the variable $message. echo"<h3>Margin Less than 15% for $datequery</h3>"; echo"<table border=1 cellpadding=3><tr><td><center><b>Invoice Number</b></center></td><td><center><b>Invoice Date</b></center></td><td><center><b>Customer Number</b></center></td><td><center><b>Company</b></center></td><td><center><b>Margin</b></center></td></tr>"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $invoice=$row['INVNO']; $invoicedate=$row['INVDTE']; $customernumber=$row['CUSTNO']; $company=$row['COMPANY']; $invoicetotal=$row['ITOTAL']; $invoicecost=$row['ICOST']; @$ABOVE30= @($invoicecost * 100) / $invoicetotal; @$FINAL30=100 - $ABOVE30; $FINAL30=number_format($FINAL30, 2, '.', ''); IF($FINAL30<="15") { echo "<tr><td><center>$invoice</center></td><td><center>$invoicedate</center></td><td><center>$customernumber</center></td><td><center>$company</center></td><td><center>$FINAL30%</center></td></tr>"; } } echo"</table><hr />"; Link to comment https://forums.phpfreaks.com/topic/230640-storing-queries-into-one-variable/ Share on other sites More sharing options...
jakebur01 Posted March 14, 2011 Author Share Posted March 14, 2011 I think I may have it. I am changing all of my echo's to $message =. Link to comment https://forums.phpfreaks.com/topic/230640-storing-queries-into-one-variable/#findComment-1187505 Share on other sites More sharing options...
Maq Posted March 14, 2011 Share Posted March 14, 2011 I'm confused, I don't see any variable in your script named message. If I had to guess, you're on the right track here: I think I may have it. I am changing all of my echo's to $message =. by concatenating the data you can store it all in a single variable. Link to comment https://forums.phpfreaks.com/topic/230640-storing-queries-into-one-variable/#findComment-1187506 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.