User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 363,832 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,122 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

PHP reminder E-mail - Cron job to run the script

Join Date: May 2008
Posts: 9
Reputation: oku is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
oku oku is offline Offline
Newbie Poster

Re: PHP reminder E-mail - Cron job to run the script

  #9  
May 18th, 2008
Hey digital-ether,

thanks for responding to my thread again.

I've been doing alot of reading and i've virtually clocked it

Now when the email sends - instead of just sending one email with the results of the query, it will send alot more

for example if the query returned 30 results it will send me 30 emails with each result of the query being in each email and i just want all results to appear one!

Here is the code im using - 90% there!

<?
mysql_connect("localhost","username","password"); 
mysql_select_db("database") or die( "Unable to select database"); 
 
 
$query="SELECT * FROM domains WHERE company_name = 'IWOOT' ORDER BY domain_name ASC";
$result=mysql_query($query);
 

$num=mysql_numrows($result);

mysql_close();


$i=0;
while ($i < $num) 

{
 
  
$id=mysql_result($result,$i,"id");
$domain_name=mysql_result($result,$i,"domain_name");
$company_name=mysql_result($result,$i,"company_name");
$simply_account=mysql_result($result,$i,"simply_account");
$notes=mysql_result($result,$i,"notes");


$exp_date = mysql_result($result,$i,"exp_date");
$exp_date = date("d-m-Y", strtotime($exp_date) );


if($query == TRUE)
    {
           
      //send email
   
      $to = "daniel.whiteside@googlemail.com";
  
      $subject = "Expriy Notice";
   
      $from = "Admin";
   
  
      $msg .= "Hello Daniel,<BR><BR>";
  
      $msg .= "Domains for Iwoot...<BR><BR>";

      $msg .= "$domain_name - $exp_date <BR><BR>";  	

      $msg .= "Admin";
 
       
  
      $headers = "MIME-Version: 1.0" . "\r\n";
  
      $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
  
      $headers .= "From: Daniel Whiteside\r\nReply-To:oku@sutsurikeru.net" . "\r\n";
 
       
 
      $mailsend = mail("$to","$subject","$msg","$headers");
  
      echo $mailsend ? "Email was sent :-)." : " Email sending failed.";


$i++;
}

} 

?> 

Where am i going wrong?

Many thanks
Reply With Quote  
All times are GMT -4. The time now is 12:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC