Jump to content

Can I make Outlook pop up with a generated email containing MySQL query results?


jonnymorris

Recommended Posts

Hi,

 

I have a regular MySQL query that displays it's results to the screen in a browser as an HTML table, all nice and fruity.  The managers who use this function like to send out the results to staff, currently they simply take a screen shot and paste it into an email to send out to everyone - quite an overhead on the email system, company network, not to mention the time taken to do the screen shot and paste it into an email in the first place.

 

It would be good if I could include a standard HTML form button (preferably) or link on the results page to shove the displayed results to Outlook as an email, that contains the table all ready for the manager to add in what ever they want to the email and then send (usually to 'all@mysite.com' but it would be useful if they could change or add to this as they see fit).  This is kind of what happens with a normal mailto HTML tag, except I want it to contain the MySQL query result too.

 

This is the existing table output routine (something I inherited):

/* Output data into a HTMl table */ 
echo "<p>";
echo "<table align=center width=800 border=\"1\">"; 
echo "<tr>"; 
echo "<td BGCOLOR=\"#ffcc00\"><strong>Agent name</strong></td>
<td BGCOLOR=\"#ffcc00\"><strong>Number of calls made / handled</strong></td>
<td BGCOLOR=\"#ffcc00\"><strong>Average call minutes</strong></td>
<td BGCOLOR=\"#ffcc00\"><strong>Total mins (inc hours + secs rounded)</strong></td>
</tr>";
						  
while($row  =  mysql_fetch_row($numresults))  { 
echo    "<tr>"; 
for($i=0;  $i < mysql_num_fields($numresults);  $i++)  { 
	echo    "<td align=center width=443>$row[$i]</td>"; 
	}            
echo    "</tr>\n";
}
echo  "</table></p>";

 

Link to comment
Share on other sites

I'm not having much luck with this.  So far this is what I've come up with, but it doesn't enter anything into the email body:

echo "<a href=\"mailto:somebody@address.co.uk?Subject=Report&Body=" . email_table($numresults) . "\">email</a>";

 

email_table() is just a function that contains a standard table MySQL output routine (which works perfectly for screen output).

 

This is what I thought would happen, and why I asked the question here.  Am I doing something wrong?  How can I best achieve this?  Please help!  ;D

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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