sstangle73 Posted August 28, 2007 Share Posted August 28, 2007 the function: function emailTaken($email){ global $conn; if(!get_magic_quotes_gpc()){ $email = addslashes($email); } $qe = "select email from users where email = '$email'"; $resulte = mysql_query($qe, $conn); return (mysql_numrows($resulte) > 0); } function birthday($birthday){ list($month,$day,$year) = explode("-",$birthday); $today = getdate(); $age = $today['year']-$year; if($month >= $today['mon'] && $day >= $today['mday']) { $age--; } return $age; } takes the birthday 10-11-1992 and returns 15 when it should be 14 can anyone see the error? Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 28, 2007 Share Posted August 28, 2007 I think you are supposed to have less thans, instead of greater thans. Quote Link to comment Share on other sites More sharing options...
frost Posted August 28, 2007 Share Posted August 28, 2007 Well this part: $month >= $today['mon'] && $day >= $today['mday'] Wouldn't work all the time. This only works if the month and day are bigger than the birthday. Today being the 28th and the birthday you are testing the 11th that routine wouldn't work. I think you need to add another check level. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 Yeah it's more like : if(($month >= $today['mon']) || ($month=$today['mon'] && $day >= $today['mday'])){ Quote Link to comment Share on other sites More sharing options...
sstangle73 Posted August 28, 2007 Author Share Posted August 28, 2007 thanks guys that worked Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.