close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Delete record : Not working

Thread began 6/08/2012 5:46 am by MikeH | Last modified 6/08/2012 8:51 am by Jason Byrnes | 868 views | 3 replies |

MikeH

Delete record : Not working

Hi
I am using the latest build yet the delete record is not doing anything.

3 image files are deleted first and then the record delte is actioned if the trigger delte 3 successful (all 3 files are deleted successfully).

But thats it the delete record does not action. (code below)

Any ideas?

Thanks Mike

php:
<?php require_once('../../Connections/Totalheadturners.php'); ?>
<?php 
require_once("../../webassist/file_manipulation/helperphp.php"); ?>
<?php 
require_once("../../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}
$colname_RsImageDetails "-1";
if (isset(
$_GET['imageid'])) {
  
$colname_RsImageDetails $_GET['imageid'];
}
mysql_select_db($database_Totalheadturners$Totalheadturners);
$query_RsImageDetails sprintf("SELECT * FROM CarImages WHERE Id = %s"GetSQLValueString($colname_RsImageDetails"int"));
$RsImageDetails mysql_query($query_RsImageDetails$Totalheadturners) or die(mysql_error());
$row_RsImageDetails mysql_fetch_assoc($RsImageDetails);
$totalRows_RsImageDetails mysql_num_rows($RsImageDetails);?>
<?php 
// WA Application Builder Delete
if ($WA_DeleteFileResult3// Trigger
{
  
$WA_connection $Totalheadturners;
  
$WA_table "CarImages";
  
$WA_redirectURL "../admin_list_images.php?carid=".$row_RsImageDetails['CarLink']  ."";
  if (
function_exists("rel2abs")) $WA_redirectURL $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  
$WA_keepQueryString false;
  
$WA_fieldNamesStr "Id";
  
$WA_columnTypesStr "none,none,NULL";
  
$WA_fieldValuesStr "".$_GET['imageid']  ."";
  
$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_Totalheadturners;
  
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(
"" == ""){
 
$WA_DeleteFileResult1 WA_FileAssist_DeleteFile("../../uploaded_images/""".$row_RsImageDetails['LargeImage']  ."");
}
?>
<?php
$WA_DeleteFileResult2 
false;
if(
$WA_DeleteFileResult1){
 
$WA_DeleteFileResult2 WA_FileAssist_DeleteFile("../../uploaded_images/medium/""".$row_RsImageDetails['LargeImage']  ."");
}
?>
<?php
$WA_DeleteFileResult3 
false;
if(
$WA_DeleteFileResult2){
 
$WA_DeleteFileResult3 WA_FileAssist_DeleteFile("../../uploaded_images/thumbs/""".$row_RsImageDetails['LargeImage']  ."");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
I am record: 
<?php echo $_GET['imageid']; ?>
</body>
</html>
<?php
mysql_free_result
($RsImageDetails);
?>
Sign in to reply to this post

Jason ByrnesWebAssist

the issue is code order.

the code for the delete record behavior comes before the code to delete the files.

to be able to trigger the record delete on the delete file success, the code to delete the file must come before the code to delete the record.

PHP Is processed from top to bottom.

Sign in to reply to this post

MikeH

Thanks Jason
That worked a charm.

Is this something I did wrong? I inserted the delete file behaviours first then the delete record was inserted last. Or is this just something that is unavoidable when using extensions?

Thanks

Mike

Sign in to reply to this post

Jason ByrnesWebAssist

probably not something you did wrong, the extensions use a weighting system to determine where in the page the code gets added, in more cases than not, the delete record and delete file code order wont be an Issue, usually the delete record would happen first. you just happened on a scenario where the file delete needed to happen first.

Sign in to reply to this post

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