close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How to delete associated file with delete button from results page

Thread began 6/25/2014 4:53 pm by Justin@AdventDesign | Last modified 9/17/2014 11:10 am by Justin@AdventDesign | 1183 views | 17 replies

Justin@AdventDesign

How to delete associated file with delete button from results page

If I've missed a tutorial somewhere, please advise. Everything I've found seems to be written before the delete record operation was changed in the "DataAssist Pages" wizard to perform the record delete on the results page rather than taking you to a separate delete page. When I insert the WebAssist > File Manipulation > Delete on the results page generated by the "DataAssist Pages" wizard, the WADeleteFile function deletes the last record in the entire results on the page, rather than the row in the recordset I clicked to delete.

How do I get the WADeleteFile function to select the record file name in association with the proper clicked row?

Here's the header code:

<?php
// WA Application Builder Delete
if (isset($_POST["Delete"]) || isset($_POST["Delete_x"])) // Trigger
{
$WA_connection = $sitecontrol;
$WA_table = "tbSlides";
$WA_redirectURL = "tbSlides_results.php?id=".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"") ."";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "id";
$WA_columnTypesStr = "',none,''";
$WA_fieldValuesStr = "".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"") ."";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_comparisions = explode("|", $WA_comparisonStr);
$WA_connectionDB = $database_sitecontrol;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$deleteParamsObj = WA_AB_generateWhereClause($WA_fieldNames, $WA_columns, $WA_fieldValues, $WA_comparisions);
$WA_Sql = "DELETE FROM `" . $WA_table . "` WHERE " . $deleteParamsObj->sqlWhereClause;
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}?>
<?php
$WA_DeleteFileResult1 = false;
if(isset($_POST["Delete"]) || isset($_POST["Delete_x"])){
$WA_DeleteFileResult1 = WA_FileAssist_DeleteFile("../cmsimages/full/", "".$row_WADAtbSlides['photo'] ."");
}
?>

And here's the code from the delete button in the row:

<input type="button" class="formButton ResultsPageButton unstyled DeleteButton" value="" onclick="document.getElementById('WADADeleteRecordID').value=<?php echo($row_WADAtbSlides['id']); ?>;document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';" />

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