icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Mail() Help

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old August 19th, 2008, 5:46 PM   #1 (permalink)
Registered User
Comfy Contributor
 
hunna03's Avatar
 
Joined in Mar 2006
Lives in UT
Hosted on SH92
165 posts
Gave thanks: 28
Thanked 0 times
Question Mail() Help

I'm running a CRON job because I can't seem to figure out how to set the $message of the mail setting when I have multiple outputs. However, instead of displaying it all pretty it shows it in the crude HTML format which isn't good for the people receiving the information. Is there any way to make this right/better?

Code:
<?php

$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");

$selected = mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");

$result = mysql_query("SELECT * FROM training ORDER BY lname");

$nowtrue = date('Y-m-d');

echo "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>
";

while ($row=mysql_fetch_assoc($result)){ extract($row);

$driverslicense = strtotime($driverslicense.'- 1 month');

$driverslicense = date('Y-m-d',$driverslicense);

$driverslicenseexpire = strtotime($driverslicense.'+ 1 month');

$driverslicenseexpire = date('n/j/Y',$driverslicenseexpire);

if ($row{'driverslicense'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $driverslicense) {	
echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire
";
}


$cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months');

$cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire);

$cdlmedical = strtotime($cdlmedical.'+ 23 months');

$cdlmedical = date('Y-m-d',$cdlmedical);

if ($row{'cdlmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $cdlmedical) {
echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire
";
}


$hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months');

$hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire);

$hazmatmedical = strtotime($hazmatmedical.'+ 11 months');

$hazmatmedical = date('Y-m-d',$hazmatmedical);

if ($row{'hazmatmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazmatmedical) {
echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire
";
}


$kucccontractorexpire = strtotime($kucccontractor.'+ 12 months');

$kucccontractorexpire = date('n/j/Y',$kucccontractorexpire);

$kucccontractor = strtotime($kucccontractor.'+ 11 months');

$kucccontractor = date('Y-m-d',$kucccontractor);

if ($row{'kucccontractor'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kucccontractor) {
echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire
";
}

$kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months');

$kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire);

$kuccehsplan = strtotime($kuccehsplan.'+ 11 months');

$kuccehsplan = date('Y-m-d',$kuccehsplan);

if ($row{'kuccehsplan'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccehsplan) {
echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire
";
}

$kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months');

$kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire);

$kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months');

$kuccconcentrator = date('Y-m-d',$kuccconcentrator);

if ($row{'kuccconcentrator'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccconcentrator) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire
";
}

$kuccmineexpire = strtotime($kuccmine.'+ 12 months');

$kuccmineexpire = date('n/j/Y',$kuccmineexpire);

$kuccmine = strtotime($kuccmine.'+ 11 months');

$kuccmine = date('Y-m-d',$kuccmine);

if ($row{'kuccmine'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccmine) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire
";
}

$kuccuppexpire = strtotime($kuccupp.'+ 12 months');

$kuccuppexpire = date('n/j/Y',$kuccuppexpire);

$kuccupp = strtotime($kuccupp.'+ 11 months');

$kuccupp = date('Y-m-d',$kuccupp);

if ($row{'kuccupp'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccupp) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire
";
}

$kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months');

$kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire);

$kuccpmetals = strtotime($kuccpmetals.'+ 11 months');

$kuccpmetals = date('Y-m-d',$kuccpmetals);

if ($row{'kuccpmetals'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccpmetals) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire
";
}


$kuccpitexpire = strtotime($kuccpit.'+ 12 months');

$kuccpitexpire = date('n/j/Y',$kuccpitexpire);

$kuccpit = strtotime($kuccpit.'+ 11 months');

$kuccpit = date('Y-m-d',$kuccpit);

if ($row{'kuccpit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccpit) {
echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>";
}

$msha46expire = strtotime($msha46.'+ 12 months');

$msha46expire = date('n/j/Y',$msha46expire);

$msha46 = strtotime($msha46.'+ 11 months');

$msha46 = date('Y-m-d',$msha46);

if ($row{'msha46'}=='0000-00-00') echo " "; 

elseif($nowtrue > $msha46) {
echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire
";
}

$msha48expire = strtotime($msha48.'+ 12 months');

$msha48expire = date('n/j/Y',$msha48expire);

$msha48 = strtotime($msha48.'+ 11 months');

$msha48 = date('Y-m-d',$msha48);

if ($row{'msha48'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $msha48) {
echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire
";
}

$mvrcheckexpire = strtotime($mvrcheck.'+ 12 months');

$mvrcheckexpire = date('n/j/Y',$mvrcheckexpire);

$mvrcheck = strtotime($mvrcheck.'+ 11 months');

$mvrcheck = date('Y-m-d',$mvrcheck);

if ($row{'mvrcheck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $mvrcheck) {
echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire
";
}

$respiratorfitexpire = strtotime($respiratorfit.'+ 12 months');

$respiratorfitexpire = date('n/j/Y',$respiratorfitexpire);

$respiratorfit = strtotime($respiratorfit.'+ 11 months');

$respiratorfit = date('Y-m-d',$respiratorfit);

if ($row{'respiratorfit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $respiratorfit) {
echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire
";
}

$respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months');

$respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire);

$respiratormedical = strtotime($respiratormedical.'+ 11 months');

$respiratormedical = date('Y-m-d',$respiratormedical);

if ($row{'respiratormedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $respiratormedical) {
echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire
";
}

$substance9expire = strtotime($substance9.'+ 12 months');

$substance9expire = date('n/j/Y',$substance9expire);

$substance9 = strtotime($substance9.'+ 11 months');

$substance9 = date('Y-m-d',$substance9);

if ($row{'substance9'}=='0000-00-00') echo " "; 

elseif($nowtrue > $substance9) {
echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire
";
}

$naislifttruckexpire = strtotime($naislifttruck.'+ 24 months');

$naislifttruckexpire = date('n/j/Y',$naislifttruckexpire);

$naislifttruck = strtotime($naislifttruck.'+ 23 months');

$naislifttruck = date('Y-m-d',$naislifttruck);

if ($row{'naislifttruck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naislifttruck) {
echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire
";
}

$naisoverheadcraneexpire = strtotime($naisoverheadcrane.'- 1 month');

$naisoverheadcraneexpire = date('Y-m-d',$naisoverheadcraneexpire);

$naisoverheadcrane = strtotime($naisoverheadcrane.'+ 1 month');

$naisoverheadcrane = date('n/j/Y',$naisoverheadcrane);

if ($row{'naisoverheadcrane'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naisoverheadcrane) {
echo "<center> $fname $lname is due for Overhead Crane Re-Training! It Expires $naisoverheadcrane
";
}

$fmchazexpire = strtotime($fmchaz.'+ 12 months');

$fmchazexpire = date('n/j/Y',$fmchazexpire);

$fmchaz = strtotime($fmchaz.'+ 11 months');

$fmchaz = date('Y-m-d',$fmchaz);

if ($row{'fmchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $fmchaz) {
echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire
";
}

$solvayhazexpire = strtotime($solvayhaz.'+ 12 months');

$solvayhazexpire = date('n/j/Y',$solvayhazexpire);

$solvayhaz = strtotime($solvayhaz.'+ 11 months');

$solvayhaz = date('Y-m-d',$solvayhaz);

if ($row{'solvayhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $solvayhaz) {
echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire
";
}

$barrickhazexpire = strtotime($barrickhaz.'+ 12 months');

$barrickhazexpire = date('n/j/Y',$barrickhazexpire);

$barrickhaz = strtotime($barrickhaz.'+ 11 months');

$barrickhaz = date('Y-m-d',$barrickhaz);

if ($row{'barrickhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $barrickhaz) {
echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire
";
}

$uitchazexpire = strtotime($uitchaz.'+ 12 months');

$uitchazexpire = date('n/j/Y',$uitchazexpire);

$uitchaz = strtotime($uitchaz.'+ 11 months');

$uitchaz = date('Y-m-d',$uitchaz);

if ($row{'uitchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $uitchaz) {
echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire
";
}

$newmonthazexpire = strtotime($newmonthaz.'+ 12 months');

$newmonthazexpire = date('n/j/Y',$newmonthazexpire);

$newmonthaz = strtotime($newmonthaz.'+ 11 months');

$newmonthaz = date('Y-m-d',$newmonthaz);

if ($row{'newmonthaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $newmonthaz) {
echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire 
";
}

$genchemhazexpire = strtotime($genchemhaz.'+ 12 months');

$genchemhazexpire = date('n/j/Y',$genchemhazexpire);

$genchemhaz = strtotime($genchemhaz.'+ 11 months');

$genchemhaz = date('Y-m-d',$genchemhaz);

if ($row{'genchemhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $genchemhaz) {
echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire
";
}

$hazwoper40expire = strtotime($hazwoper40.'+ 12 months');

$hazwoper40expire = date('n/j/Y',$hazwoper40expire);

$hazwoper40 = strtotime($hazwoper40.'+ 11 months');

$hazwoper40 = date('Y-m-d',$hazwoper40);

if ($row{'hazwoper40'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper40) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire
";
}

$hazwoper24expire = strtotime($hazwoper24.'+ 12 months');

$hazwoper24expire = date('n/j/Y',$hazwoper24expire);

$hazwoper24 = strtotime($hazwoper24.'+ 11 months');

$hazwoper24 = date('Y-m-d',$hazwoper24);

if ($row{'hazwoper24'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper24) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire
";
}

$firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months');

$firstaidcprexpire = date('n/j/Y',$firstaidcprexpire);

$firstaidcpr = strtotime($firstaidcpr.'+ 11 months');

$firstaidcpr = date('Y-m-d',$firstaidcpr);

if ($row{'firstaidcpr'}=='0000-00-00') echo " "; 

elseif($nowtrue > $firstaidcpr) {
echo "<center>
$fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire
";


}}

?>
__________________
~CJA~
72.29.87.117
"Constantly lost in the world of PHP" is my personal understatement.
hunna03 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 6:05 PM   #2 (permalink)
Surpass Developer
Excelling Contributor
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
509 posts
Gave thanks: 20
Thanked 78 times
PHP Code:
$headers "MIME-Version: 1.0\r\n";
$headers .= "From: yourmail@domain.com\r\n";
$headers .= "Content-Type: multipart/alternative; boundary = nextPart\r\n";
$message "--nextPart\r\nContent-type: text/html; charset=iso-8859-1\r\n" $message;

mail($to$subject$message$headers); 
You can use that code to send the contents of $message as a properly encoded HTML e-mail. But as for your code, I'm kind of confused as to what you are doing. Are you sending all of the echoed out content to a single e-mail? or are you trying to send each instance of the while loop to a different e-mail?
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks Mark for this great post!
hunna03 (August 20th, 2008)
Old August 19th, 2008, 6:14 PM   #3 (permalink)
Registered User
Comfy Contributor
 
hunna03's Avatar
 
Joined in Mar 2006
Lives in UT
Hosted on SH92
165 posts
Gave thanks: 28
Thanked 0 times
Everything is being outputted into one email. If it was singular that would be much easier I'd speculate. Attached is an actual print screen of what is being sent.
Attached Thumbnails
mail-help-example.jpg  
__________________
~CJA~
72.29.87.117
"Constantly lost in the world of PHP" is my personal understatement.
hunna03 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 7:47 PM   #4 (permalink)
Registered User
Comfy Contributor
 
hunna03's Avatar
 
Joined in Mar 2006
Lives in UT
Hosted on SH92
165 posts
Gave thanks: 28
Thanked 0 times
Okay, so I tried adding the MAIL statement to the script but am getting an error. Any ideas?

Error: Parse error: syntax error, unexpected T_STRING in /home/clintona/public_html/NASG/required/training/trainingcheck.php on line 22

Code:

<?php

$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");

$selected = mysql_select_db("clintona_SLC",$dbhandle)
or die("Can not open SLC Database");

$result = mysql_query("SELECT * FROM training ORDER BY lname");

$nowtrue = date('Y-m-d');

$email = "binaryblaster@gmail.com";

$subject = "NorthAmerican Expiring Training Report"; 
$message = "

echo "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>";

while ($row=mysql_fetch_assoc($result)){ extract($row);

$driverslicense = strtotime($driverslicense.'- 1 month');

$driverslicense = date('Y-m-d',$driverslicense);

$driverslicenseexpire = strtotime($driverslicense.'+ 1 month');

$driverslicenseexpire = date('n/j/Y',$driverslicenseexpire);

if ($row{'driverslicense'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $driverslicense) {    
echo "<center> $fname $lname is due for a Drivers License renewal! It Expires $driverslicenseexpire
";
}


$cdl = strtotime($driverslicense.'- 1 month');

$cdl = date('Y-m-d',$cdl);

$cdlexpire = strtotime($cdlexpire.'+ 1 month');

$cdlexpire = date('n/j/Y',$cdlexpire);

if ($row{'cdl'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $cdl) {    
echo "<center> $fname $lname is due for a CDL renewal! It Expires $cdlexpire
";
}


$cdlmedicalexpire = strtotime($cdlmedical.'+ 24 months');

$cdlmedicalexpire = date('n/j/Y',$cdlmedicalexpire);

$cdlmedical = strtotime($cdlmedical.'+ 23 months');

$cdlmedical = date('Y-m-d',$cdlmedical);

if ($row{'cdlmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $cdlmedical) {
echo "<center> $fname $lname is due for a CDL Medical Evaluation! It Expires $cdlmedicalexpire
";
}


$hazmatmedicalexpire = strtotime($hazmatmedical.'+ 12 months');

$hazmatmedicalexpire = date('n/j/Y',$hazmatmedicalexpire);

$hazmatmedical = strtotime($hazmatmedical.'+ 11 months');

$hazmatmedical = date('Y-m-d',$hazmatmedical);

if ($row{'hazmatmedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazmatmedical) {
echo "<center> $fname $lname is due for a HazMat Medical Evaluation! It Expires $hazmatmedicalexpire
";
}


$kucccontractorexpire = strtotime($kucccontractor.'+ 12 months');

$kucccontractorexpire = date('n/j/Y',$kucccontractorexpire);

$kucccontractor = strtotime($kucccontractor.'+ 11 months');

$kucccontractor = date('Y-m-d',$kucccontractor);

if ($row{'kucccontractor'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kucccontractor) {
echo "<center> $fname $lname is due for KUCC Contractor Orientation! It Expires $kucccontractorexpire
";
}

$kuccehsplanexpire = strtotime($kuccehsplan.'+ 12 months');

$kuccehsplanexpire = date('n/j/Y',$kuccehsplanexpire);

$kuccehsplan = strtotime($kuccehsplan.'+ 11 months');

$kuccehsplan = date('Y-m-d',$kuccehsplan);

if ($row{'kuccehsplan'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccehsplan) {
echo "<center> $fname $lname is due to renew the KUCC Personal EH & S Plan! It Expires $kuccehsplanexpire
";
}

$kuccconcentratorexpire = strtotime($kuccconcentrator.'+ 12 months');

$kuccconcentratorexpire = date('n/j/Y',$kuccconcentratorexpire);

$kuccconcentrator = strtotime($kuccconcentrator.'+ 11 months');

$kuccconcentrator = date('Y-m-d',$kuccconcentrator);

if ($row{'kuccconcentrator'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccconcentrator) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Concentrator Program! It Expires $kuccconcentratorexpire
";
}

$kuccmineexpire = strtotime($kuccmine.'+ 12 months');

$kuccmineexpire = date('n/j/Y',$kuccmineexpire);

$kuccmine = strtotime($kuccmine.'+ 11 months');

$kuccmine = date('Y-m-d',$kuccmine);

if ($row{'kuccmine'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccmine) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Mine & Copperton Program! It Expires $kuccmineexpire
";
}

$kuccuppexpire = strtotime($kuccupp.'+ 12 months');

$kuccuppexpire = date('n/j/Y',$kuccuppexpire);

$kuccupp = strtotime($kuccupp.'+ 11 months');

$kuccupp = date('Y-m-d',$kuccupp);

if ($row{'kuccupp'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccupp) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition UPP Program! It Expires $kuccuppexpire
";
}

$kuccpmetalsexpire = strtotime($kuccpmetals.'+ 12 months');

$kuccpmetalsexpire = date('n/j/Y',$kuccpmetalsexpire);

$kuccpmetals = strtotime($kuccpmetals.'+ 11 months');

$kuccpmetals = date('Y-m-d',$kuccpmetals);

if ($row{'kuccpmetals'}=='0000-00-00') echo " "; 

elseif($nowtrue > $kuccpmetals) {
echo "<center> $fname $lname is due for the KUCC Hazard Recognition Precious Metals Program! It Expires $kuccpmetalsexpire
";
}


$kuccpitexpire = strtotime($kuccpit.'+ 12 months');

$kuccpitexpire = date('n/j/Y',$kuccpitexpire);

$kuccpit = strtotime($kuccpit.'+ 11 months');

$kuccpit = date('Y-m-d',$kuccpit);

if ($row{'kuccpit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $kuccpit) {
echo "<center> $fname $lname is due for the KUCC Pit License! It Expires $kuccpitexpire <p></center>";
}

$msha46expire = strtotime($msha46.'+ 12 months');

$msha46expire = date('n/j/Y',$msha46expire);

$msha46 = strtotime($msha46.'+ 11 months');

$msha46 = date('Y-m-d',$msha46);

if ($row{'msha46'}=='0000-00-00') echo " "; 

elseif($nowtrue > $msha46) {
echo "<center> $fname $lname is due for MSHA Part 46 Training! It Expires $msha46expire
";
}

$msha48expire = strtotime($msha48.'+ 12 months');

$msha48expire = date('n/j/Y',$msha48expire);

$msha48 = strtotime($msha48.'+ 11 months');

$msha48 = date('Y-m-d',$msha48);

if ($row{'msha48'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $msha48) {
echo "<center> $fname $lname is due for MSHA Part 48 Training! It Expires $msha48expire
";
}

$mvrcheckexpire = strtotime($mvrcheck.'+ 12 months');

$mvrcheckexpire = date('n/j/Y',$mvrcheckexpire);

$mvrcheck = strtotime($mvrcheck.'+ 11 months');

$mvrcheck = date('Y-m-d',$mvrcheck);

if ($row{'mvrcheck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $mvrcheck) {
echo "<center> $fname $lname is due for an MVR Check! It Expires $mvrcheckexpire
";
}

$respiratorfitexpire = strtotime($respiratorfit.'+ 12 months');

$respiratorfitexpire = date('n/j/Y',$respiratorfitexpire);

$respiratorfit = strtotime($respiratorfit.'+ 11 months');

$respiratorfit = date('Y-m-d',$respiratorfit);

if ($row{'respiratorfit'}=='0000-00-00') echo " "; 

elseif ($nowtrue > $respiratorfit) {
echo "<center> $fname $lname is due for a Respirator Fit Test! It Expires $respiratorfitexpire
";
}

$respiratormedicalexpire = strtotime($respiratormedical.'+ 12 months');

$respiratormedicalexpire = date('n/j/Y',$respiratormedicalexpire);

$respiratormedical = strtotime($respiratormedical.'+ 11 months');

$respiratormedical = date('Y-m-d',$respiratormedical);

if ($row{'respiratormedical'}=='0000-00-00') echo " "; 

elseif($nowtrue > $respiratormedical) {
echo "<center> $fname $lname is due for a Respirator Medical Evaluation! It Expires $respiratormedicalexpire
";
}

$substance9expire = strtotime($substance9.'+ 12 months');

$substance9expire = date('n/j/Y',$substance9expire);

$substance9 = strtotime($substance9.'+ 11 months');

$substance9 = date('Y-m-d',$substance9);

if ($row{'substance9'}=='0000-00-00') echo " "; 

elseif($nowtrue > $substance9) {
echo "<center> $fname $lname is due for a NIDA 9-Panel Drug Test! It Expires $substance9expire
";
}

$naislifttruckexpire = strtotime($naislifttruck.'+ 24 months');

$naislifttruckexpire = date('n/j/Y',$naislifttruckexpire);

$naislifttruck = strtotime($naislifttruck.'+ 23 months');

$naislifttruck = date('Y-m-d',$naislifttruck);

if ($row{'naislifttruck'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naislifttruck) {
echo "<center> $fname $lname is due for the NAIS Task Training Lift Truck Training! It Expires $naislifttruckexpire
";
}

$naisoverheadcraneexpire = strtotime($naisoverheadcrane.'- 1 month');

$naisoverheadcraneexpire = date('Y-m-d',$naisoverheadcraneexpire);

$naisoverheadcrane = strtotime($naisoverheadcrane.'+ 1 month');

$naisoverheadcrane = date('n/j/Y',$naisoverheadcrane);

if ($row{'naisoverheadcrane'}=='0000-00-00') echo " "; 

elseif($nowtrue > $naisoverheadcrane) {
echo "<center> $fname $lname is due for Overhead Crane Re-Training! It Expires $naisoverheadcrane
";
}

$fmchazexpire = strtotime($fmchaz.'+ 12 months');

$fmchazexpire = date('n/j/Y',$fmchazexpire);

$fmchaz = strtotime($fmchaz.'+ 11 months');

$fmchaz = date('Y-m-d',$fmchaz);

if ($row{'fmchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $fmchaz) {
echo "<center> $fname $lname is due for FMC Corp. Retraining! It Expires $fmchazexpire
";
}

$solvayhazexpire = strtotime($solvayhaz.'+ 12 months');

$solvayhazexpire = date('n/j/Y',$solvayhazexpire);

$solvayhaz = strtotime($solvayhaz.'+ 11 months');

$solvayhaz = date('Y-m-d',$solvayhaz);

if ($row{'solvayhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $solvayhaz) {
echo "<center> $fname $lname is due for Solvay Chemicals Retraining! It Expires $solvayhazexpire
";
}

$barrickhazexpire = strtotime($barrickhaz.'+ 12 months');

$barrickhazexpire = date('n/j/Y',$barrickhazexpire);

$barrickhaz = strtotime($barrickhaz.'+ 11 months');

$barrickhaz = date('Y-m-d',$barrickhaz);

if ($row{'barrickhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $barrickhaz) {
echo "<center> $fname $lname is due for Barrick Goldstrike Retraining! It Expires $barrickhazexpire
";
}

$uitchazexpire = strtotime($uitchaz.'+ 12 months');

$uitchazexpire = date('n/j/Y',$uitchazexpire);

$uitchaz = strtotime($uitchaz.'+ 11 months');

$uitchaz = date('Y-m-d',$uitchaz);

if ($row{'uitchaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $uitchaz) {
echo "<center> $fname $lname is due for UITC Retraining! It Expires $uitchazexpire
";
}

$newmonthazexpire = strtotime($newmonthaz.'+ 12 months');

$newmonthazexpire = date('n/j/Y',$newmonthazexpire);

$newmonthaz = strtotime($newmonthaz.'+ 11 months');

$newmonthaz = date('Y-m-d',$newmonthaz);

if ($row{'newmonthaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $newmonthaz) {
echo "<center> $fname $lname is due for Newmont Retraining! It Expires $newmonthazexpire 
";
}

$genchemhazexpire = strtotime($genchemhaz.'+ 12 months');

$genchemhazexpire = date('n/j/Y',$genchemhazexpire);

$genchemhaz = strtotime($genchemhaz.'+ 11 months');

$genchemhaz = date('Y-m-d',$genchemhaz);

if ($row{'genchemhaz'}=='0000-00-00') echo " "; 

elseif($nowtrue > $genchemhaz) {
echo "<center> $fname $lname is due for General Chemicals Retraining! It Expires $genchemhazexpire
";
}

$hazwoper40expire = strtotime($hazwoper40.'+ 12 months');

$hazwoper40expire = date('n/j/Y',$hazwoper40expire);

$hazwoper40 = strtotime($hazwoper40.'+ 11 months');

$hazwoper40 = date('Y-m-d',$hazwoper40);

if ($row{'hazwoper40'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper40) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper40expire
";
}

$hazwoper24expire = strtotime($hazwoper24.'+ 12 months');

$hazwoper24expire = date('n/j/Y',$hazwoper24expire);

$hazwoper24 = strtotime($hazwoper24.'+ 11 months');

$hazwoper24 = date('Y-m-d',$hazwoper24);

if ($row{'hazwoper24'}=='0000-00-00') echo " "; 

elseif($nowtrue > $hazwoper24) {
echo "<center> $fname $lname is due for 8-Hour Hazwoper Refresher training! It Expires $hazwoper24expire
";
}

$firstaidcprexpire = strtotime($firstaidcpr.'+ 12 months');

$firstaidcprexpire = date('n/j/Y',$firstaidcprexpire);

$firstaidcpr = strtotime($firstaidcpr.'+ 11 months');

$firstaidcpr = date('Y-m-d',$firstaidcpr);

if ($row{'firstaidcpr'}=='0000-00-00') echo " "; 

elseif($nowtrue > $firstaidcpr) {
echo "<center>
$fname $lname is due for a First-Aid/CPR Refresher Course! It Expires $firstaidcprexpire
";


}}

";
mail($email, $subject, $message,
"From: NorthAmerican Services Group<binaryblaster@gmail.com>\n 
X-Mailer: PHP/" . phpversion());

?>

?>
__________________
~CJA~
72.29.87.117
"Constantly lost in the world of PHP" is my personal understatement.
hunna03 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 7:53 PM   #5 (permalink)
Surpass Developer
Excelling Contributor
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
509 posts
Gave thanks: 20
Thanked 78 times
Looks like it might be:

PHP Code:
$message "

echo "
Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>"; 
remove the echo "
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 7:55 PM   #6 (permalink)
Registered User
Comfy Contributor
 
hunna03's Avatar
 
Joined in Mar 2006
Lives in UT
Hosted on SH92
165 posts
Gave thanks: 28
Thanked 0 times
But that wouldn't echo the WHILE results. That would just echo that one line, would it not?
__________________
~CJA~
72.29.87.117
"Constantly lost in the world of PHP" is my personal understatement.
hunna03 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 8:00 PM   #7 (permalink)
Surpass Developer
Excelling Contributor
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
509 posts
Gave thanks: 20
Thanked 78 times
Right, but what is there is a coding syntax error. Your trying to assign something to $message and then not closing the quotes or terminating the line with a semicolon. The correct syntax would be:

PHP Code:
$message "";

echo 
"Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>"
Now if you are trying to both assign that statement and echo it, then you could do:

PHP Code:
$message "Salt Lake City Expiring Training Report - If nothing is below there are no actions needed:<p>";

echo 
$message
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 19th, 2008, 8:03 PM   #8 (permalink)
Registered User
Comfy Contributor
 
hunna03's Avatar
 
Joined in Mar 2006
Lives in UT
Hosted on SH92
165 posts
Gave thanks: 28
Thanked 0 times
Well I'm trying to assign that statement and then everything else that is echoed as a result of the giant WHILE statement. The " 's keep getting in the way of me doing that. So I've tried encapsulating the whole thing "( and it still hasn't worked.
__________________
~CJA~
72.29.87.117
"Constantly lost in the world of PHP" is my personal understatement.
hunna03 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August