Forums
This topic is locked
Automatically delete record
Posted 19 Feb 2007 21:54:26
1
has voted
19 Feb 2007 21:54:26 Ra Canting posted:
Could someone help?I have a database (MS acces) where people can place adverts. When the user submits an advert the date is added to a date field within the database.
What I want to do is set the advert to expire after a certain week of time. I use asp Vb script with Macromaedia dreamveaver
Thanxs in advance.
Replies
Replied 20 Feb 2007 05:55:15
20 Feb 2007 05:55:15 Javier Castro replied:
in your advanced Recordset:
in your SQL query:
WHERE dteAdvert > #Param#
then in your Parameters window:
Name: Param
Type: Date
Value: Now()-14 <------------------ play with this value to get your desired time period
defaultValue: 1/1/2000
hope it helps.
in your SQL query:
WHERE dteAdvert > #Param#
then in your Parameters window:
Name: Param
Type: Date
Value: Now()-14 <------------------ play with this value to get your desired time period
defaultValue: 1/1/2000
hope it helps.
Replied 20 Feb 2007 19:22:58
20 Feb 2007 19:22:58 Alan C replied:
I think you will have to use the DATE_ADD or DATE_SUBTRACT functions in mysql, something like this
<pre id=code><font face=courier size=2 id=code>$updateSQL = sprintf("UPDATE properties SET p_expiry_date=%s, p_entry_type=%s WHERE p_id=%s",
'DATE_ADD(NOW(), INTERVAL '.ENHANCED_TRIAL_DAYS.' DAY)'
</font id=code></pre id=code>
the rest if that statement was the parameters so I didn't include them, it's probably different in MS access although I had an idea that you could use sql with access.
Edited by - sitemaster on 20 Feb 2007 19:24:42
<pre id=code><font face=courier size=2 id=code>$updateSQL = sprintf("UPDATE properties SET p_expiry_date=%s, p_entry_type=%s WHERE p_id=%s",
'DATE_ADD(NOW(), INTERVAL '.ENHANCED_TRIAL_DAYS.' DAY)'
</font id=code></pre id=code>
the rest if that statement was the parameters so I didn't include them, it's probably different in MS access although I had an idea that you could use sql with access.
Edited by - sitemaster on 20 Feb 2007 19:24:42