ckdoublenecks 10:26:10 | I'm trying to retrieve an expiration date from a database and compare it to today's date. If the expiration date hasn't arrived yet, I want to redirect the program, if if it has I want to display a message.
|
smo1234 10-26-2010 | You are trying to retrieve all the records, but in your case you will redirect in particular case only. I mean a particular record you will check against expire date and then redirect. It is always better to use the query to collect the records than collect the record and then compare. So your query should be like this.
This will display all records for which expire date is not yet arrived. You can change this to get all records which are expiring today.
|
ckdoublenecks 10-27-2010 | the only retrieval I'm making is the expiration date from the database. Then I want to execute one program or the other depending on whether the expiration date has been reached. |
smo1234 10-27-2010 | There are problems in the code. 1. You are getting the noticidate & expiredate from the form posting by not using inside the query. Query should be select expiredate from entrydate where noticedat = '$noticedate' 2. You have to use mysql_fetch_object to get the expiredate and then you need not convert it into string, directly you can match with today. |
ckdoublenecks 10-27-2010 | until I get this going I'm not even using the noticedate field |