<p>I need a way to modify a value in a table after a certain amount of time has passed.  My current method is as follow:</p>

<ul>
<li>insert end time for wait period in table</li>
<li>when a user loads a page requesting the value to be changed, check to see if current >= end time</li>
<li>if it is, change the value and remove the end time field, if it isn't, do nothing</li>
</ul>

<p>This is going to be a major feature on the site, and so efficiency is the key; with that in mind, you can probably see the problem with how I'm doing it.  That same chunk of code is going to be called every time someone access a page that needs the information.</p>

<p>Any suggestions for improvements or better methods would be greatly appreciated, preferably in php or perl.</p>

<p>In response to cron job answers:
Thanks, and I'd like to do something like that if possible, but hosts limits are the problem.  Since this is a major part of the app, it can't be limited.  </p>

Can you use a cron job to check each field in the database periodically and update that way?
A big part of this is how frequently the updates are required.  A lot of shared hosts limit the frequency of cron checks, for example no more than every 15 minutes, which could affect the application.