Change Age automatically

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hamedx
Forum Newbie
Posts: 8
Joined: Wed Aug 20, 2008 9:38 am

Change Age automatically

Post by hamedx »

hi guys . im new to php , is it possible to change age value in mysql automatically when year changes ?
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: Change Age automatically

Post by it2051229 »

i think no with mysql alone.. you have to create a program for that in php...
hamedx
Forum Newbie
Posts: 8
Joined: Wed Aug 20, 2008 9:38 am

Re: Change Age automatically

Post by hamedx »

thanks for reply my friend ,googling not work for me .. can you tell me how to do that ?
anand
Forum Commoner
Posts: 80
Joined: Fri May 22, 2009 11:07 am
Location: India
Contact:

Re: Change Age automatically

Post by anand »

you can do a while loop. :)

quick code

Code: Select all

$rows = mysql_query("SELECT * FROM user";) or die(mysql_error());
 
while ($x = mysql_fetch_array($rows)) {
 
mysql_query("UPDATE user SET age = age+'1'";)
 
}
Post Reply