Problem with DFP and Data Assist Update page
Hi,
Back again...after the insert page I am now having a few hassles with the update page.
A few people have had the same that I can see, I am sure my problem is simple as well.
I cannon get my update page to either upload the file or change the filename in the thumb image field in the db.
Here is a sample of my relevant code. (Upload and update)
I have tried the debug, but nothing comes up.
Any ideas guys?? Thanks!
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../images/user/thumbs/",
'FileName' => "[FileName]",
'DefaultFileName' => "".((isset($_POST["thumbImg"]))?$_POST["thumbImg"]:"") ."",
'ResizeType' => "1",
'ResizeWidth' => "85",
'ResizeHeight' => "85",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "thumbUpdate", "0", "", "JPG:80", $WA_UploadResult1_Params);
}
?>
<?php
// WA Application Builder Update
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $connPriefert;
$WA_table = "content";
$WA_redirectURL = "newsDetail.php?contentID=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_keepQueryString = false;
$WA_indexField = "contentID";
$WA_fieldNamesStr = "contentTitle|thumbImg|contentHome|contentLong|contentShort|date";
$WA_fieldValuesStr = "".((isset($_POST["contentTitle"]))?$_POST["contentTitle"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["contentHome"]))?$_POST["contentHome"]:"") ."" . "|" . "".((isset($_POST["contentLong"]))?$_POST["contentLong"]:"") ."" . "|" . "".((isset($_POST["contentShort"]))?$_POST["contentShort"]:"") ."" . "|" . "".((isset($_POST["date"]))?$_POST["date"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);
$WA_connectionDB = $database_connPriefert;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->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);
}
}
?>
And now for the update form:
<form action="newsUpdate.php?contentID=<?php echo(rawurlencode($row_WADAcontent['contentID'])); ?>" method="post" name="WADAUpdateForm" id="WADAUpdateForm">
<div class="WADAHeader">Update Record</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">Date:</th>
<td class="WADADataTableCell"><input type="text" name="date" id="date" value="<?php echo(str_replace('"', '"', $row_WADAcontent['date'])); ?>" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Title:</th>
<td class="WADADataTableCell"><input type="text" name="contentTitle" id="contentTitle" value="<?php echo(str_replace('"', '"', $row_WADAcontent['contentTitle'])); ?>" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Thumb Image:</th>
<td class="WADADataTableCell"><input type="hidden" name="thumbImg" id="thumbImg" value="<?php echo(str_replace('"', '"', $row_WADAcontent['thumbImg'])); ?>"/><input type="file" name="thumbUpdate" />
</td>
</tr>
<tr>
<td> </td><td><img src="../images/user/thumbs/<?php echo $row_WADAcontent['thumbImg']; ?>" alt="News Thumb" width="85" height="85" hspace="10" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Home Page<br />Content:</th>
<td class="WADADataTableCell"><textarea id="contentHome" name="contentHome" rows="3" cols="60" style="width: 100%"><?php echo $row_WADAcontent['contentHome']; ?>
</textarea></td>
</tr>
<tr>
<th class="WADADataTableHeader">News List<br />Page Content</th>
<td class="WADADataTableCell"><textarea id="contentShort" name="contentShort" rows="6" cols="60" style="width: 100%"><?php echo(str_replace('"', '"', $row_WADAcontent['contentShort'])); ?>
</textarea></td>
</tr>
<tr>
<th class="WADADataTableHeader">News Detail<br />
Content
:</th>
<td class="WADADataTableCell"><?php
// WebAssist iRite: Rich Text Editor for Dreamweaver
$WARichTextEditor_1 = CreateRichTextEditor ("contentLong", "../../HTMLEditor/", "600px", "400px", "Default", "../custom/news_Update_contentLong3.js", "".($totalRows_WADAcontent > 0)?$row_WADAcontent['contentLong']:($row_WADAContent['contentLong']) ."");
?></td>
</tr>
</table>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Update" id="Update" value="Update" alt="Update" src="../WA_DataAssist/images/Pacifica/Refined_update.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="news_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="../WA_DataAssist/images/Pacifica/Refined_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAUpdateRecordID" type="hidden" id="WADAUpdateRecordID" value="<?php echo(rawurlencode($row_WADAcontent['contentID'])); ?>" />
</div>
</form>
Any ideas guys?