graham23s Posted July 26, 2007 Share Posted July 26, 2007 Hi Guys, i'm not sure how to go about the if/else code i'm trying to write, basically when a profile is made i get the "Join Date" (which is basically a timestamp) then add 1 hour to it like: $time = date('Y-m-d H:i:s', strtotime("$added +1 hour")); what i was wanting to happen is , when the new timestamp is met ($time) which is 1 hour ahead some text saying "new profle" disappears (so basically new profile only stays there untill the 1 hour is up) then disappears would an if else statement do this at all? thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/61896-solved-ifelse-to-meet-a-condition/ Share on other sites More sharing options...
cooldude832 Posted July 26, 2007 Share Posted July 26, 2007 its more than an if else statement, you are talking a sorta cron job or something of that nature, its more of (if you using mysql) select `UserID` From Users Where CreationDate >= $time that will get you all users made in last hour then say <?php $query = "select `UserID` From Users Where CreationDate >= $time"; $result = mysql_query($query) or die(Mysql_error()); while($row = mysql_fetch_assoc($result){ { $tempQ = "Update Users Set New=0 Where UserID = $row['UserID']"; mysql_query($tempQ); } ?> to give you a rough idea Link to comment https://forums.phpfreaks.com/topic/61896-solved-ifelse-to-meet-a-condition/#findComment-308178 Share on other sites More sharing options...
vbnullchar Posted July 26, 2007 Share Posted July 26, 2007 <?php $d=<timestamp from db>; if(date('g',$d)<>date('d')) echo "new profile"; ?> Link to comment https://forums.phpfreaks.com/topic/61896-solved-ifelse-to-meet-a-condition/#findComment-308185 Share on other sites More sharing options...
graham23s Posted July 26, 2007 Author Share Posted July 26, 2007 Thanks guys i got some code together that's done the3 job:) thanks guys Graham Link to comment https://forums.phpfreaks.com/topic/61896-solved-ifelse-to-meet-a-condition/#findComment-308290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.