Page 1 of 1

Please someone..anything! Help!!

Posted: Thu Mar 26, 2009 9:47 am
by javiqq
:banghead:
I was asked to create another condition. If the date the client initially registered is more than 12 months ago then they'll have to take a 12th month survey, if less than 12th month then they'll have to take the 6th month survey. Now so you understand, the 6th month code already existed when I started working here so all I added was the 12th month condition. However, here's the part that confuses me. There's a column in the database that keeps track of when the 6th month survey was taken so when i created the 12th month condition I created a new column to keep track of that date but now that I'm trying to figure out how that date is being entered I'm told that it's timestamped, so supposedly it does it automatically. I don't get it! Where in the code below does it create a new record or lets that field in MySQL that it should update??? Please help!

Code: Select all

 
 
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 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="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="http://sphprojects.umdnj.edu/perseus/se.ashx?s=6A0A4CEE6D258687#A1" target="_blank"><b><u> Visit Survey</u></b></a>';
                }
                mysql_close();
            }
        }else{
            
        }
 

Re: Please someone..anything! Help!!

Posted: Thu Mar 26, 2009 10:20 am
by papa
If it's a timestamp that column gets updated automatically when you update the database table.

Re: Please someone..anything! Help!!

Posted: Thu Mar 26, 2009 10:25 am
by javiqq
papa wrote:If it's a timestamp that column gets updated automatically when you update the database table.
Ok so whenever the "Table" gets updated that column is updated automatically? If yes, that means I can't have two columns with the timestamp because then both would update with same information. If i'm correct, then how could I make it so the 6th & 12th month field in db update when the respective link is clicked on?

Re: Please someone..anything! Help!!

Posted: Thu Mar 26, 2009 10:29 am
by papa
You add a cloumn with DATE instead and update it accordingly.

Re: Please someone..anything! Help!!

Posted: Thu Mar 26, 2009 10:46 am
by javiqq
papa wrote:You add a cloumn with DATE instead and update it accordingly.
Could you assist me with adding the required code? I'm fairly new to php and haven't really gotten that deep into coding it yet.

I already added a column type DATE for the 12th month as you can in the script above.