ido3dfx
07-14-2008, 05:27 PM
I have a user table in which each record has an id and a date field (among otheres)
the id is int and the date field is date formatted 0000-00-00
I want a query to run any time this page is viewed (this way no form is needed) that it would update the date field in every record when compared to the current date.
$now = date ('Y-m-d');
$query = "SELECT * FROM `t1m_users` WHERE `active` ='1' ";
$result = mysql_query($query) or die(mysql_error());
$i = 0;
while $row = mysql_fetch_array($result));{
$id = $row['id'];
$expired = $row['join_expd'];
++$i;
}
I know I need to loop and check each users 'join_expd' field and compare it to $now then if it is greater (meaning now = 2008-07-15 and join_expd = 2008-07-14 ) I want to set the active fields to '0'.
this will set all users accounts who have expired to inactive. I dont want to delete them.
thanks in advance for the help
best regards,
MM :)
the id is int and the date field is date formatted 0000-00-00
I want a query to run any time this page is viewed (this way no form is needed) that it would update the date field in every record when compared to the current date.
$now = date ('Y-m-d');
$query = "SELECT * FROM `t1m_users` WHERE `active` ='1' ";
$result = mysql_query($query) or die(mysql_error());
$i = 0;
while $row = mysql_fetch_array($result));{
$id = $row['id'];
$expired = $row['join_expd'];
++$i;
}
I know I need to loop and check each users 'join_expd' field and compare it to $now then if it is greater (meaning now = 2008-07-15 and join_expd = 2008-07-14 ) I want to set the active fields to '0'.
this will set all users accounts who have expired to inactive. I dont want to delete them.
thanks in advance for the help
best regards,
MM :)