PDA

View Full Version : Digital File Pro to DataAsist Insert and Update pages Errors


paul313952
08-20-2009, 03:57 AM
Hi Folks,

Im using DataAssist and Digital File Pro and have followed the guides to insert and update DA file upload to existing Insert and Update pages.
When applied, i get the following message when trying to insert a new product:
Notice: Undefined index: WA_UploadResult1 in C:\Inetpub\wwwroot\Barker Backup\clearance\newcastle\admin\stock_Insert.php on line 15

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\wwwroot\Barker Backup\clearance\newcastle\admin\stock_Insert.php: 15) in C:\Inetpub\wwwroot\Barker Backup\clearance\newcastle\admin\stock_Insert.php on line 22
Field 'Code' doesn't have a default value

On looking at it and comparing it with the backup file i made before i used DFP, ive noticed the following:
On the original backed up file, this looks like this:
$WA_connection = $global;
$WA_table = "stock";
$WA_sessionName = "WADA_Insert_stock";
$WA_redirectURL = "stock_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "ID";
$WA_fieldNamesStr = "Code|ProductName|ImageLge|Image|Description|Price| Category|Status";
$WA_fieldValuesStr = "".((isset($_POST["Code"]))?$_POST["Code"]:"") ."" . "|" . "".((isset($_POST["ProductName"]))?$_POST["ProductName"]:"") ."" . "|" . "".((isset($_POST["ImageLge"]))?$_POST["ImageLge"]:"") ."" . "|" . "".((isset($_POST["Image"]))?$_POST["Image"]:"") ."" . "|" . "".((isset($_POST["Description"]))?$_POST["Description"]:"") ."" . "|" . "".((isset($_POST["Price"]))?$_POST["Price"]:"") ."" . "|" . "".((isset($_POST["Category"]))?$_POST["Category"]:"") ."" . "|" . "".((isset($_POST["Status"]))?$_POST["Status"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

The newly replaced file with DFP applied to it looks like this:
$WA_connection = $global;
$WA_table = "stock";
$WA_sessionName = "WADA_Insert_stock";
$WA_redirectURL = "stock_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "ID";
$WA_fieldNamesStr = "ImageLge";
$WA_fieldValuesStr = "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

Can you advise on the best way forward to rectify this issue.

Best regards

Paul

Jason Byrnes
08-20-2009, 09:37 AM
This is a code order error.

make sure the line that looks like:
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

is at line 1 0f your page.

paul313952
08-21-2009, 02:05 AM
Hi Jason,
This has cured the initial error message, however when you insert a new product it just adds a blank entry into the database since adding DFP.

Any ideas?

Thanks

Paul

Jason Byrnes
08-21-2009, 09:56 AM
Can you compress your page in a zip file and attach it to your replay so I can look at the code in it's entirety?

paul313952
08-24-2009, 01:06 AM
Hi Jason,
Attached is the page in its entirity complete with the DFP addition.
Ive also attached the original page zipped up which works fine without DFP so you can compare.

Cheers

Paul

Jason Byrnes
08-24-2009, 02:25 PM
The code for the Digital File Pro upload is at lines 63 - 83:
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../gallery/images/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "4",
'ResizeWidth' => "300",
'ResizeHeight' => "220",
'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", "fileField", "0", "", "true", $WA_UploadResult1_Params);
}
?>



move this code to line 4 so the file is uploaded before the record is inserted.