close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Get download count from a nested recordset

Thread began 6/19/2021 11:15 am by Mags | Last modified 7/01/2021 2:38 pm by Ray Borduin | 531 views | 9 replies |

Mags

Get download count from a nested recordset

Hi Ray, I want to record the number of downloads on a page which has a nested recordset. I moved the download behavior after the nested recordset but it gives me the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxxx.doc' at line 1

Would you mind taking a look at the page to see where I'm going wrong?

Sign in to reply to this post

Ray BorduinWebAssist

The file download code has to be on the top of the page before any other code runs. You will have to move the code from lines 281-286 above to line 27.

That isn't what is causing the error though. The error is because you have specified a varchar column as the key column in the compliance_manual_vault2 table. The download count code currently only works with numeric key columns... usually a unique key or auto-increment column.

If you have a numeric key in that table, then you should be able to update the download server behavior to use that key and it will fix the problem. If you need to get it to work with a varchar column, post back and I'll give you instructions on what code needs to be updated.

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

Mags

Hi Ray, sorry for the delay in replying, had to get a few other things sorted out on the site so this had to wait.

I've had another look at the page and changed the key column to the ID column, however I would need to pass the ID from the nested recordset which of course doesn't appear until further down the page, so with the download behavior at the top it doesn't work. How would I get around this? I've attached the updated page.

Sign in to reply to this post

Ray BorduinWebAssist

Maybe add the value to a hidden form element with the others around line 402 and then you can use the POST value in the download.

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

Mags

That works, thanks!

Sign in to reply to this post

Mags

I decided now that I've got that working to add a download count to another page where we offer downloadable documents. This one just used an ordinary recordset. Tried using the ID from the recordset which didn't work, so then added a hidden field to the form with the ID number, then added the the details to the download behavior by specifying the key column value as the POST value. However it's not recording a count in the database. Can you see what might be wrong? I've attached the page.

Sign in to reply to this post

Ray BorduinWebAssist

It looks correct to me. If you give me a url to the page to test and FTP access then I can debug and figure it out.

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

Mags

Yeah, I'm sure it's right too, just can't see what the problem might be! Details are in PM.

Sign in to reply to this post

Ray BorduinWebAssist

The issue is that it doesn't work with NULL values in the download count. It has a hard time incrementing... I updated the download helper file to fix this issue.

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

Mags

Thanks for fixing!

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