PHP how to update database?

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
php_postgresql
Forum Newbie
Posts: 13
Joined: Sat Apr 19, 2008 9:37 am

PHP how to update database?

Post by php_postgresql »

I dont know what to put in my subject because I dont know how to categorize my question. I need people's suggestions on how will I do this...

I have managed to compare the current dates and expiration dates of records. When they fill up a form I have this expiration question thingy so there. I was able to store in my database if the product is still OK or not OK. I used the timestamps thingy to do compare current date and expiration date...( the strtotime() )...

but then how would the database know if it is still OK the next day? when someone created a profile for example it is not expired today (so it is flagged OK in the database) but tomorrow it will be expired (so it should be flagged "NOT OK").

how can I update the database?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP how to update database?

Post by Christopher »

Compare the date in the record with NOW().
(#10850)
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Re: PHP how to update database?

Post by mchaggis »

If you want the database to "automatically" update, then the only real way to do it would be to have a scheduled task (cron) on the server that performs the check and does the update. It looks like you have the code/sql how sussed, just seems you are wondering how you can do it without intervention?
Post Reply