Jump to content

[SOLVED] My comparison is not working


thefollower

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.