Clinton Posted April 22, 2008 Share Posted April 22, 2008 In one table I have probably about 45 columns and right now about 60 rows of information. The bulk of that information contains dates. I want to create a CRON job that will take today's date and if it's a year past the date on file it will send out an e-mail. Now, how is the best way to go about this? In my table I have id, name, date1, date2, date3, date4, etc... so in one column it could show up to 40 dates being out of sync at one time. But I'm not sure how to do this. Is this just as simple as a WHILE statement and picking out the outdated dates? It's probably not as hard as I'm making it out to be there's just a crap load of information and i'm not sure how to handle it. Thanks. This code below is to show how much data I'm working with. html> <head> <title>Salt Lake City Training Report</title> <STYLE TYPE="text/css"> <!-- td{font-family: Arial; font-size: 8pt;} ---> </STYLE> </head> <body bgcolor="#FFFFFF"> <font size="2"><a href="training.php"> Return to Training </a></font><p> <table border="1" width="8000px"> <font size="1"> <tr><td>Name:</td> <td><center>Date of Birth:</td> <td><center>CDL License Expire:</td> <td><center>CDL Medical Evaluation:</td> <td><center>Confined Space:</td> <td><center>Drivers License:</td> <td><center>HazMat Medical Evaluation:</td> <td><center>KUCC Contractor Orientation:</td> <td><center>KUCC EMS Level II:</td> <td><center>KUCC MOC:</td> <td><center>KUCC Personal EH & S Plan:</td> <td><center>KUCC Hazard Recognition Concentrator:</td> <td><center>KUCC Hazard Recognition Mine & Copperton:</td> <td><center>KUCC Hazard Recognition UPP:</td> <td><center>KUCC Hazard Recognition Precious Metals:</td> <td><center>KUCC Hazard Recognition Smelter:</td> <td><center>KUCC Hazard Recognition Tailings:</td> <td><center>KUCC Working at Heights:</td> <td><center>KUCC Pit License:</td> <td><center>MSHA Part 46:</td> <td><center>MSHA Part 48:</td> <td><center>MVR Check:</td> <td><center>OSHA 30 Hour:</td> <td><center>Respirator Fit Test:</td> <td><center>Respirator Medical Evaluation:</td> <td><center>Substance Abuse Prevention Program EE Ackgt:</td> <td><center>Substance Abuse Screen NIDA 9-Panel:</td> <td><center>Substance Abuse Screen DOT 5-panel:</td> <td><center>Substance Abuse Screen DOT Alcohol:</td> <td><center>NAIS Task Training Company Orientation:</td> <td><center>NAIS Task Training Employee Handbook:</td> <td><center>NAIS Task Training Ar Pb Cd Exp Prgm:</td> <td><center>NAIS Task Training Vacuum Truck:</td> <td><center>NAIS Task Training Hydro-Blaster:</td> <td><center>NAIS Task Training Explosives:</td> <td><center>NAIS Task Training Aerial Work Platform:</td> <td><center>NAIS Task Training Lift Truck:</td> <td><center>NAIS Task Training Hazwoper:</td> <td><center>Hazard Training FMC Corp:</td> <td><center>Hazard Training Solvay Chemicals:</td> <td><center>Hazard Training Barrick Goldstrike:</td> <td><center>Hazard Training UITC:</td> <td><center>Hazard Training Newmont:</td> <td><center>Hazard Training General Chemical:</td> <td><center>Hazwoper 40 Hour:</td> <td><center>Hazwoper 24 Hour:</td> <td><center>First Aid / CPR:</td> </tr> <? while ($row=mysql_fetch_assoc($result)){ extract($row); if ($dob=='0000-00-00'){ $dob = " "; } else{ $dob = date('n/j/Y',strtotime($dob)); } if ($cdl=='0000-00-00') { $cdl = " "; } else{ $cdl = date('n/j/Y',strtotime($cdl)); } if ($cdlmedical=='0000-00-00') { $cdlmedical = " "; } else{ $cdlmedical = date('n/j/Y',strtotime($cdlmedical)); } if ($confinedspace=='0000-00-00') { $confinedspace = " "; } else{ $confinedspace = date('n/j/Y',strtotime($confinedspace)); } if ($driverslicense=='0000-00-00') { $driverslicense = " "; } else{ $driverslicense = date('n/j/Y',strtotime($driverslicense)); } if ($hazmatmedical=='0000-00-00') { $hazmatmedical = " "; } else{ $hazmatmedical = date('n/j/Y',strtotime($hazmatmedical)); } if ($kucccontractor=='0000-00-00') { $kucccontractor = " "; } else{ $kucccontractor = date('n/j/Y',strtotime($kucccontractor)); } if ($kuccems2=='0000-00-00') { $kuccems2 = " "; } else{ $kuccems2 = date('n/j/Y',strtotime($kuccems2)); } if ($kuccmoc=='0000-00-00') { $kuccmoc = " "; } else{ $kuccmoc = date('n/j/Y',strtotime($kuccmoc)); } if ($kuccehsplan=='0000-00-00') { $kuccehsplan = " "; } else{ $kuccehsplan = date('n/j/Y',strtotime($kuccehsplan)); } if ($kuccconcentrator=='0000-00-00') { $kuccconcentrator = " "; } else{ $kuccconcentrator = date('n/j/Y',strtotime($kuccconcentrator)); } if ($kuccmine=='0000-00-00') { $kuccmine = " "; } else{ $kuccmine = date('n/j/Y',strtotime($kuccmine)); } if ($kuccupp=='0000-00-00') { $kuccupp = " "; } else{ $kuccupp = date('n/j/Y',strtotime($kuccupp)); } if ($kuccpmetals=='0000-00-00') { $kuccpmetals = " "; } else{ $kuccpmetals = date('n/j/Y',strtotime($kuccpmetals)); } if ($kuccsmelter=='0000-00-00') { $kuccsmelter = " "; } else{ $kuccsmelter = date('n/j/Y',strtotime($kuccsmelter)); } if ($kucctailings=='0000-00-00') { $kucctailings = " "; } else{ $kucctailings = date('n/j/Y',strtotime($kucctailings)); } if ($kuccheights=='0000-00-00') { $kuccheights = " "; } else{ $kuccheights = date('n/j/Y',strtotime($kuccheights)); } if ($kuccpit=='0000-00-00') { $kuccpit = " "; } else{ $kuccpit = date('n/j/Y',strtotime($kuccpit)); } if ($msha46=='0000-00-00') { $msha46 = " "; } else{ $msha46 = date('n/j/Y',strtotime($msha46)); } if ($msha48=='0000-00-00') { $msha48 = " "; } else{ $msha48 = date('n/j/Y',strtotime($msha48)); } if ($mvrcheck=='0000-00-00') { $mvrcheck = " "; } else{ $mvrcheck = date('n/j/Y',strtotime($mvrcheck)); } if ($osha30=='0000-00-00') { $osha30 = " "; } else{ $osha30 = date('n/j/Y',strtotime($osha30)); } if ($respiratorfit=='0000-00-00') { $respiratorfit = " "; } else{ $respiratorfit = date('n/j/Y',strtotime($respiratorfit)); } if ($respiratormedical=='0000-00-00') { $respiratormedical = " "; } else{ $respiratormedical = date('n/j/Y',strtotime($respiratormedical)); } if ($substanceeea=='0000-00-00') { $substanceeea = " "; } else{ $substanceeea = date('n/j/Y',strtotime($substanceeea)); } if ($substance9=='0000-00-00') { $substance9 = " "; } else{ $substance9 = date('n/j/Y',strtotime($substance9)); } if ($substance5=='0000-00-00') { $substance5 = " "; } else{ $substance5 = date('n/j/Y',strtotime($substance5)); } if ($substancealcohol=='0000-00-00') { $substancealcohol = " "; } else{ $substancealcohol = date('n/j/Y',strtotime($substancealcohol)); } if ($naisorientation=='0000-00-00') { $naisorientation = " "; } else{ $naisorientation = date('n/j/Y',strtotime($naisorientation)); } if ($naishandbook=='0000-00-00') { $naishandbook = " "; } else{ $naishandbook = date('n/j/Y',strtotime($naishandbook)); } if ($naisarpbcd=='0000-00-00') { $naisarpbcd = " "; } else{ $naisarpbcd = date('n/j/Y',strtotime($naisarpbcd)); } if ($naisvacuum=='0000-00-00') { $naisvacuum = " "; } else{ $naisvacuum = date('n/j/Y',strtotime($naisvacuum)); } if ($naishydro=='0000-00-00') { $naishydro = " "; } else{ $naishydro = date('n/j/Y',strtotime($naishydro)); } if ($naisexplosives=='0000-00-00') { $naisexplosives = " "; } else{ $naisexplosives = date('n/j/Y',strtotime($naisexplosives)); } if ($naisplatform=='0000-00-00') { $naisplatform = " "; } else{ $naisplatform = date('n/j/Y',strtotime($naisplatform)); } if ($naislifttruck=='0000-00-00') { $naislifttruck = " "; } else{ $naislifttruck = date('n/j/Y',strtotime($naislifttruck)); } if ($naishazwoper=='0000-00-00') { $naishazwoper = " "; } else{ $naishazwoper = date('n/j/Y',strtotime($naishazwoper)); } if ($fmchaz=='0000-00-00') { $fmchaz = " "; } else{ $fmchaz = date('n/j/Y',strtotime($fmchaz)); } if ($solvayhaz=='0000-00-00') { $solvayhaz = " "; } else{ $solvayhaz = date('n/j/Y',strtotime($solvayhaz)); } if ($barrickhaz=='0000-00-00') { $barrickhaz = " "; } else{ $barrickhaz = date('n/j/Y',strtotime($barrickhaz)); } if ($uitchaz=='0000-00-00') { $uitchaz = " "; } else{ $uitchaz = date('n/j/Y',strtotime($uitchaz)); } if ($newmonthaz=='0000-00-00') { $newmonthaz = " "; } else{ $newmonthaz = date('n/j/Y',strtotime($newmonthaz)); } if ($genchemhaz=='0000-00-00') { $genchemhaz = " "; } else{ $genchemhaz = date('n/j/Y',strtotime($genchemhaz)); } if ($hazwoper40=='0000-00-00') { $hazwoper40 = " "; } else{ $hazwoper40 = date('n/j/Y',strtotime($hazwoper40)); } if ($hazwoper24=='0000-00-00') { $hazwoper24 = " "; } else{ $hazwoper24 = date('n/j/Y',strtotime($hazwoper24)); } if ($firstaidcpr=='0000-00-00') { $firstaidcpr = " "; } else{ $firstaidcpr = date('n/j/Y',strtotime($firstaidcpr)); } /* ##################### */ /* END CDL Check */ /* ##################### */ echo <<<END <tr> <td> $lname, $fname $mname.</td> <td><center> $dob </td> <td><center> $cdl </td> <td><center> $cdlmedical </td> <td><center> $confinedspace </td> <td><center> $driverslicense </td> <td><center> $hazmatmedical </td> <td><center> $kucccontractor </td> <td><center> $kuccems2 </td> <td><center> $kuccmoc </td> <td><center> $kuccehsplan </td> <td><center> $kuccconcentrator </td> <td><center> $kuccmine </td> <td><center> $kuccupp </td> <td><center> $kuccpmetals </td> <td><center> $kuccsmelter </td> <td><center> $kucctailings </td> <td><center> $kuccheights </td> <td><center> $kuccpit </td> <td><center> $msha46 </td> <td><center> $msha48 </td> <td><center> $mvrcheck </td> <td><center> $osha30 </td> <td><center> $respiratorfit </td> <td><center> $respiratormedical </td> <td><center> $substanceeea </td> <td><center> $substance9 </td> <td><center> $substance5 </td> <td><center> $substancealcohol </td> <td><center> $naisorientation </td> <td><center> $naishandbook </td> <td><center> $naisarpbcd </td> <td><center> $naisvacuum </td> <td><center> $naishydro </td> <td><center> $naisexplosives </td> <td><center> $naisplatform </td> <td><center> $naislifttruck </td> <td><center> $naishazwoper </td> <td><center> $fmchaz </td> <td><center> $solvayhaz </td> <td><center> $barrickhaz </td> <td><center> $uitchaz </td> <td><center> $newmonthaz </td> <td><center> $genchemhaz </td> <td><center> $hazwoper40 </td> <td><center> $hazwoper24 </td> <td><center> $firstaidcpr </td> </tr> END; } ?> </table> </font> </body> </html> Link to comment https://forums.phpfreaks.com/topic/102268-rows-and-querys/ Share on other sites More sharing options...
Clinton Posted April 22, 2008 Author Share Posted April 22, 2008 Anybody? Link to comment https://forums.phpfreaks.com/topic/102268-rows-and-querys/#findComment-523953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.