Can someone please explain what this script is doing?
The mysql database is configured the following way:
tblPart_ID_Pk | Type: int(5)
tblPart_FirstTwoLettersMothersFirstName | Type: char(2)
tblPart_TwoDigitBirthYear | Type: tinyint(2)
tblPart_TwoDigitBirthDay | Type: tinyint(2)
tblPart_Timestamp | Type: datetime
tblPart_twelveMonthDate | Type: date
tblPart_sixthMonthDate | Type: date
<?php
if($result){
if(mysql_num_rows($result)==1){
$row=mysql_fetch_assoc($result);
echo '<p><b>Client ID: </b>'.$row[tblPart_ID_Pk].'<br>';
echo '<p><b>Mother\'s Initials: </b>'.$row[tblPart_FirstTwoLettersMothersFirstName].'<br>';
echo '<p><b>Birth Year: </b>'.$row[tblPart_TwoDigitBirthYear].'<br>';
echo '<p><b>Birth Day: </b>'.$row[tblPart_TwoDigitBirthDay].'<br>';
echo '<p><b>Initial Survey/Registration Date: </b>'.date("m.d.Y", strtotime($row[tblPart_Timestamp])).'</p>';
echo '<p><b>Click here for Client <font color="red">'.$row[tblPart_ID_Pk].'</font></b>';
if ((date('Y-m-d') >= date('Y-m-d', DateAdd('m', 12, strtotime($row[tblPart_Timestamp])))) && $row[tblPart_twelveMonthDate] =='0000-00-00'){
#echo '<a href="http://sphprojects.umdnj.edu/perseus/se.ashx?s=6A0A4CEE6D258687#A1" target="_blank" onClick= "return confirm(\'Click OK, ONLY if you are about to complete the 6-Month Survey, otherwise click CANCEL.\')"><b><u> 6-Month Survey</u></b></a>';
echo '<a href="http://sphprojects.umdnj.edu/perseus/se.ashx?s=6A0A4CEE6D258687#A1" target="_blank" onClick= "return confirm(\'Click OK, ONLY if you are about to complete the 12-Month Survey, otherwise click CANCEL.\')"><b><u> 12-Month Survey</u></b></a>';
}elseif ((date('Y-m-d') >= date('Y-m-d', DateAdd('m', 6, strtotime($row[tblPart_Timestamp])))) && $row[tblPart_sixthMonthDate] =='0000-00-00'){
#echo '<a href=\'processSurveyRedirect.php?participantID='.$row[tblPart_ID_Pk].'&survey=sixMonth\' target="_blank" onClick= "return confirm(\'Click OK, ONLY if you are about to complete the 6-Month Survey, otherwise click CANCEL.\')";><b><u> 6-Month Survey</u></b></a>';
echo '<a href="http://sphprojects.umdnj.edu/perseus/se.ashx?s=6A0A4CEE6D258687#A1" target="_blank" onClick= "return confirm(\'Click OK, ONLY if you are about to complete the 6-Month Survey, otherwise click CANCEL.\')"><b><u> 6-Month Survey</u></b></a>';
}else{
#echo '<a href=\'processSurveyRedirect.php?participantID='.$row[tblPart_ID_Pk].'&survey=followup\' target="_blank"><b><u> Visit Survey</u></b></a>';
echo '<a href="http://sphprojects.umdnj.edu/perseus/se.ashx?s=6A0A4CEE6D258687#A1" target="_blank"><b><u> Visit Survey</u></b></a>';
}
mysql_close();
}
}else{
}
?>
The script was originally created to keep track of when a sixth month survey was taken by the user clicking on the link. However, now we need to add a link to the 12th month survey and keep track of then that was initiated. As you can see I manage to edit the script and add the 12th month survey link and it works fine. However, I'm not keeping track of when that survey was initiated. I asked the programmer who wrote originally wrote this script and he said the field in the mysql database was setup to update automatically, but the field isn't type "timestamp". Also I think with two separate fields for two separate surveys you cannot continue with that same setup because then both fields would update when either survey is taken.
I don't know, maybe I'm just understanding this wrong but if someone can help me understand this script better and where its actually putting a timestamp for the sixth month survey and how I can do the same for the 12th month survey I would greatly appreciate it.
FYI: I'm not all that experienced with PHP. I'm trying to learn it but it's been difficult so any help would be very much appreciated.