close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Getting the next ID before insert

Thread began 5/30/2016 12:14 pm by Christopher West | Last modified 6/01/2016 1:53 pm by Ray Borduin | 295 views | 3 replies |

Christopher WestCommunity Expert

Getting the next ID before insert

Hi quick question. I want to get the ID of the next record before inset.

Reason, I want to create a product record which upon form submit will store the ID of the record in another table for product images, now since the product hasnt been created until the form submit is pressed, I need a way of getting the next record ID. What would be the syntax for this?

In essence, I need, [latest ProductID]+1

Chris

Sign in to reply to this post

Ray BorduinWebAssist

Can't you store the images after the insert? Using latest ProductID +1 may not work consistently. The best solution is to do the image inserts after the master insert. The newly inserted ID will be saved in the session and can be referenced on the same page after the insert for the image inserts.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Ray, ok my follow on question to this would (I haven't tested it yet).

So from your solution, if I have 1 HTML form on the page and the form elements are separated as tabs, And I am storing the data into 2 different database tables, does this mean that I can have 2 separate webassist insert server behaviors triggering on the same form submit. but the image insert will be triggered first, followed by the second inset for the main data?

Following on from this, is it possible to allow many image inserts on the same page (for additional product images) what I mean is, once the client add one image filename to the form, then another input box appears via javascript, and this keep repeating as much as the client wishes. then on form submit, the insert for images will insert many records at the same time?

Chris

Sign in to reply to this post

Ray BorduinWebAssist

I don't know your database structure, but I'm assuming you want to have the main record ID when you insert into the images table, so you would have two inserts, but you would insert the main table data first and then insert the images after once you have the ID from the main table.

Yes you could do multiple inserts in this way, but it would require some hand coding in both javascript and php to pull off.

Sign in to reply to this post

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