Jump to content

Pulling info from a DB - then E-mail it


Person

Recommended Posts

Hello,

 

What i need to do is pull some info from a DB and then E-mail in a nice form to an E-mail address.

 

This is what i got so far, but i cant get it working... maybe someone could help me out. thanks

 

<?php
$host = "localhost";
$user = "xxxxxx";
$pass = "xxxxxx";
$dbname = "xxxxxxx";

$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname)

$query= "SELECT SUM(1) AS clicks, SUM(`clcpc`), SUM(`chcpc`) FROM `nuke_pnAffiliate_clicktracking` WHERE `pl` = 'rpu' AND  `date` = '20070418'";
echo $query;

$result= mysql_query($query);
$num_results = mysql_num_rows($result);

for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo "Clicks: ", $row['user_id'], ";
}

$to = "[email protected]";
$from = " server do not reply";
$title = "Total Clicks report";
$body = <<< emailbody
Dear $user,

$result= mysql_query($query);

Thank you,
Site

emailbody;
   $success = mail($to,$from,$title,$body,
              "From:$from\r\nReply-To: server do not reply");

?>

Link to comment
https://forums.phpfreaks.com/topic/49706-pulling-info-from-a-db-then-e-mail-it/
Share on other sites

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.