close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete database data when date passes automatically

Thread begun 11/23/2010 1:49 pm by bill173836 | Last modified 11/29/2010 8:48 am by Ray Borduin | 3483 views | 7 replies |

bill173836

Delete database data when date passes automatically

Is there a way for dataassist to delete inserted data in my database when A specific date passes. I have a database that uses a date field and I want it to automatically delete from the database when that date is passed.

Sign in to reply to this post

Brad Lawryk

You could try adding the delete multiple records to your home page for example then when anyone visited your home page any records prior to what ever date you put in your recordset would get deleted.

I haven't tried it but I don't see why it wouldn't work.

Sign in to reply to this post

Ray BorduinWebAssist

You can probably just add a recordset to the top of the page with a query like:

DELETE FROM Table WHERE DateField < NOW()

Sign in to reply to this post
Did this help? Tips are appreciated...

bill173836

<?php DELETE FROM events WHERE Date < 'NOW()'; ?>

I tried this but all I'm getting is a parsing error. An suggestions?

Sign in to reply to this post

bill173836

Thanks, I figured it out.

<?php
$con = mysql_connect("localhost","databasename","databasepassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("databasename", $con);
mysql_query("DELETE FROM TableName WHERE FieldName < NOW()");
mysql_close($con);
?>

Sign in to reply to this post

Ray BorduinWebAssist

or just use the DW recordset and enter that as the query in the advanced tab and you don't have to write any of the other code by hand.

Sign in to reply to this post
Did this help? Tips are appreciated...

bill173836

I tried that but dreamweaver would let me save it. It kept saying that it needed something.

Sign in to reply to this post

Ray BorduinWebAssist

I see... yeah I guess you would have to create the recordset with:

SELECT * FROM TableName WHERE FieldName < NOW()

and then edit it in the code to the actual query you want after it is applied.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...