close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Delete multiple records and files?

Thread began 6/26/2012 8:20 am by MikeH | Last modified 8/16/2013 4:50 pm by MikeH | 1737 views | 21 replies

Jason ByrnesWebAssist

the record deletion is the easy part.

your delete page will have a hidden element that is used to pass the ID of the record to delete, in your example, the value of the hidden element would be 50:

php:
<input type="hidden" name="deleteID" id="deleteID" value="50" />



you would add two delete record behaviors.

the first for tableA, set the key column to ID and the value to use the deleteID hidden form element.

in the second delete behavior for tableB, set the key column to Thelink and for the value use the deleteID hidden element again.


the tougher part will be deleting the files. This will take a little bit of hand coding, but not to much.

First create a recordset to query tableB and filter the Thelink column using the deleteID form element.

This will return a recordset that contains all of the file names to delete.

Then add the delete file behavior, set the trigger to recordset recordsetName is not empty

Set the Delete folder to the folder that contains the images to delete.

for the file name, click the lightning bolt icon and select the Imagename column

the delete file code on the page will look similar to this:

php:
<?php

$WA_DeleteFileResult1 
false;
if((
$totalRows_recordsetName == 0)){
    
$WA_DeleteFileResult1 WA_FileAssist_DeleteFile("imageFolder/""".$row_recordsetName['Imagename']  ."");
}
?>



We need to add a loop around that code to loop through the recordset:

php:
<?php do { ?>

<?php
$WA_DeleteFileResult1 
false;
if((
$totalRows_recordsetName == 0)){
    
$WA_DeleteFileResult1 WA_FileAssist_DeleteFile("imageFolder/""".$row_recordsetName['Imagename']  ."");
}
?>
<?php 
} while ($row_recordsetName mysql_fetch_assoc($recordsetName)); ?>

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...