Jump to content

[SOLVED] if/else to meet a condition


graham23s

Recommended Posts

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

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

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.