Jump to content

Recommended Posts

I have a code which loads up the register date of the user compares that date to the the very instant of now, and then i have an if statement to do "if older than X amount of days - do this"

 

But its not working :(

 

This is what i have:

 

//get register date and now date
$GetDate = mysql_query("SELECT DATEDIFF(NOW(), RegisterDate) AS DaysOld FROM userregistration 
				WHERE  UserID='{$_SESSION['Current_User']}'")
				or die(mysql_error());
$daysoldrow = mysql_fetch_assoc($GetDate);

 

Then the if statement:

 

if ($daysoldrow['DaysOld'] > 200) {code blah blah; }

 

Any one see the problem i made ?

Link to comment
https://forums.phpfreaks.com/topic/66070-solved-my-comparison-is-not-working/
Share on other sites

i have found a problem. you are correct how ever i knew that already. but the problem is with my table field.

 

I edited the field "resgisterdate" and set the year to 2004 from 2007.

 

How ever when i save it resets back to how it was. No idea how its doing that. Any thoughts? Im thinking its field setting related but i dont know much about the settings of time stamps in tables.

 

 

Argh its sorted now. It was my field settings i had "on update" attribute on . That was clumsy of me ! thanks for the help though guys. I wldnt of spotted it without you guys :P

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.