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 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);
?>