close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Syntax Errors - MySQLi Insert Record + Upload Files - Page won't even load!

Thread began 2/03/2015 6:47 am by Nathon Jones Web Design | Last modified 2/11/2015 10:46 am by Jason Byrnes | 4558 views | 24 replies |

Nathon Jones Web Design

Syntax Errors - MySQLi Insert Record + Upload Files - Page won't even load!

Everything is showing as fine in the server behaviours tab, and we've even added PHP error reporting to see what the problem might be but all we're served is a blank page.

Checking the code, it highlights two syntax errors in the insert section:

$InsertQuery->bindColumn("jbphoto", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverSimpleFileName"] ."", "jbphoto"]["name"]) :"") ."", "WA_DEFAULT");

$InsertQuery->bindColumn("jbschedule", "s", "".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverSimpleFileName"] ."", "jbschedule"]["name"]) :"") ."", "WA_DEFAULT");

These are our two file upload fields.
We've tried changing this to SimpleFileName, but that didn't resolve it.

Page attached and details on how to access this online are provided below. Thank you.
NJ

Sign in to reply to this post

Nathon Jones Web Design

Page access details below:

Sign in to reply to this post

Jason ByrnesWebAssist

edit line 41 - 42:

$InsertQuery->bindColumn("jbphoto", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverSimpleFileName"]  ."", "jbphoto"]["name"]) :"")  ."", "WA_DEFAULT");
$InsertQuery->bindColumn("jbschedule", "s", "".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverSimpleFileName"] ."", "jbschedule"]["name"]) :"") ."", "WA_DEFAULT");



to:

$InsertQuery->bindColumn("jbphoto", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."", "WA_DEFAULT");
$InsertQuery->bindColumn("jbschedule", "s", "".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"] ."", "WA_DEFAULT");




i'm not sure where the extra ."", "jbphoto"]["name"]) :"") ."" code is coming from, I'm not able to reproduce.

Sign in to reply to this post

Nathon Jones Web Design

I'm not doing anything other than applying/editing the extension Jason.

I'm afraid I'm not convinced by the "I'm not able to reproduce" line which, disappointingly, is becoming more frequent. The simple fact of the matter is that some WebAssist extensions do some very unusual things and are quite unreliable. I, invariably, end up on here having to find some workaround which is time consuming and frustrating.

I appreciate the resolution, but it would nice not to have to deal with weird code insertions. It's certainly nothing we're doing.

Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

I understand your frustration, and I will continue looking for a trigger that is causing the issue.

Sign in to reply to this post

Nathon Jones Web Design

Server Validation Restrict Content
jQuery Styling
MySQLi Insert

These extensions don't work as they're supposed to and despite the issues having being raised and apparently "logged" no resolution arrives and we're left having to hand code workarounds every time we want to use them. It's slow going and isn't what we thought we'd paid for.

Regarding the original issue in this thread. The page is now going bananas and I just don't have the time to spend trying to figure out why the WebAssist extensions aren't working the way they're supposed to.

When we go back in to edit either of the File Upload behaviours, and then return to our page, they are showing as doubled up in our Bindings panel (see attached).

Here's the code though...

<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../property-for-sale/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "../property-for-sale/thumbs/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "160",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End?>
<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
'UploadFolder' => "../property-schedules/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["addpropBTN"]) || isset($_POST["addpropBTN_x"])){
WA_DFP_UploadFiles("WA_UploadResult2", "jbschedule", "2", "[NewFileName]_[Increment]", "false", $WA_UploadResult2_Params);
}
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["addpropBTN"]) || isset($_POST["addpropBTN_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "jbphoto", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>

When we attempt to test this form. None of the file names are being saved to database.

We also have a corresponding UPDATE form within this admin section and, surprise surprise, it's not doing what it's supposed to do either. No file names are being saved to database. Checking our server I can see that the files are being uploaded so what is the problem with the file names?

As well as getting that to work properly we'd like, for both forms, to know what the "Default file" option is for. We've tried the help page:
http://assets.webassist.com/html-help/261/digital_file_pro_upload_2.html

...but of course there is no mention of that so we aren't even able to help ourselves with this stuff. <sigh>
I thought 2015 was going to be better than last year but it's fast turning into more of the same.

Please can you resolve these bugs? They are slowing workflow and are causing nothing but resentment towards WebAssist with whom we've invested a significant amount of money.

Thank you
NJ

Attached Files
edit-property.php
Sign in to reply to this post

Nathon Jones Web Design

Originally Said By: Jason Byrnes
  I understand your frustration, and I will continue looking for a trigger that is causing the issue.  



MySQLi Insert Record doesn't save file names to database. To replicate the error that occurs though try this...

1) Create a MySQLi Insert Record with a file upload field
2) Add the File Manipulation > Upload Files behaviour
3) In the column bindings for the MySQLi Insert Record behaviour bind the file field in your database to the [fielfieldname] Simple File Name option in your Insert form.
4) This inserts something similar to this:
<?php echo((isset($_FILES["filenamefield"]))? preg_replace('/.[^.]*$/', '', $_FILES["filenamefield"]["name"]) :"") ?>
5) OK

You'll end up this either this:
$InsertQuery->bindColumn("filenamefield", "s", "".((isset($_FILES["filenamefield"]))? preg_replace('/.[^.]*$/', '', $_FILES["filenamefield"]["name"]) :"") ."", "filenamefield"]["name"]) :"") ."", "WA_DEFAULT");

Or this:
$InsertQuery->bindColumn("filenamefield", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."", "filenamefield"]["name"]) :"") ."", "WA_DEFAULT");

With error sometimes...
"It appears that one of your server-side values is improperly coded. Please check this interface for inconsistencies."

So, go back in to the Column Bindings section and this time bind the database field field to the Upload Files (filenamefield) > Server File Name or Upload Files (filenamefield) > Simple Server File Name (neither work).

Upload and you'll find that it doesn't save the file name to database but does upload the file.
Tearing my hair (what's left of it) out here.

Please help.
NJ

Sign in to reply to this post

Nathon Jones Web Design

So, another bug to report...

Checking the code for any pages with either an Insert and or Update function combined with File Upload I note that the code is inserted the wrong way around. The WAUpload sections are always inserted after the Insert or Update section which renders them useless.

I've manually moved these around, as there is no way to do it via the WebAssist extension, and it is now saving the filename to database.
Can this go on the list, if nothing else? It's a genuine issue.

A problem remains though, and I can't find any documentation on it which is a little frustrating, but when we use an Update form and we don't happen to select a new file upload - rather we just change something in another form field and make no changes to the file field, it appears to be overwriting whatever filename already existed in the database or, at the very least, is wiping the value causing our database default values to be applied.

What is "Default file" in the File Manipulation: Upload Wizard and what should be selected there for:
a) Insert forms
b) Update forms

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

The solution is the Default file setting as it appears you have figured out.

The default file setting should be set to whatever you want the file field value to be when no file is selected. On insert pages it can be set to be blank or set to an actual default stock photo.

On update pages it is generally set to the current value in the database so that if no new file is selected it keeps its current value by default.

Since you noted issues with the order of the code you should make sure the order is:
1) recordset
2) file upload
3) update

Sign in to reply to this post
Did this help? Tips are appreciated...

Nathon Jones Web Design

Originally Said By: Ray Borduin
  The default file setting should be set to whatever you want the file field value to be when no file is selected. On insert pages it can be set to be blank or set to an actual default stock photo.  



Our database field, that stores the filename, has a default value of empty.jpg which is the default stock photo. We, therefore, don't require anything in the Default File field.

We got around the Update page following this advice but, after what you've said above, I'm confused by Jason's first statement here.

Originally Said By: Jason Byrnes
  an image field cannot be given a default value.

you should create a hidden form element, bind the hidden form element to the image column from the update page recordset.

Then in the upload File behavior, bind the Default File Name setting to the hidden form element.

In the Update record behavior, bind the image column to the Server File name binding.  



I, therefore, do no understand the point of the Default File option for Update forms. Can you clarify?
Also, if you didn't know about this workaround then wouldn't you be left feeling mighty confused about the extension?
The Update form would ALWAYS overwrite your filename.

Originally Said By: Ray Borduin
  Since you noted issues with the order of the code you should make sure the order is:
1) recordset
2) file upload
3) update  



Why doesn't the extension insert the code in the correct order? This is happening with Insert and Update forms at present.

Thank you.
NJ

Sign in to reply to this post
loading

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