close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Max ID - Last Record

Thread began 8/20/2012 3:46 pm by john70964 | Last modified 8/21/2012 1:22 pm by john70964 | 1097 views | 6 replies |

john70964

Max ID - Last Record

After inserting a new record with Data assist
I wish to be able to view that information in a detail page.

How can I create the recordset so that it defaults to the last inserted record (Max)

Many thanks

John

Sign in to reply to this post

Jason ByrnesWebAssist

the insert record behavior will store the ID of the inserted record to a session variable.

Double click the insert record behavior, and make not of the name of the Save As section, this is the name of the session variable that is created.

you can use this session to filter your recordset.

Sign in to reply to this post

john70964

Thanks Jason

Sounds excellent.
Will have a go!
Regards

John

Sign in to reply to this post

john70964

Hello Jason
I tried to get this working but could not get the last record to show after an insert

I am attaching a couple of images which show how I set up the Insert record screen and the Recordset.

Obviously I am getting this wrong as no record shows after the insert.

I wonder if you can see my mistake(s).

Thanks
John

Sign in to reply to this post

john70964

Interesting I found this at
loading-a-recordset-at-57970.html

SELECT * from tablename
WHERE primarykey = (SELECT MAX(primarykey) FROM tablename)
which I have previously used with an access db

Seems to work with MySql. Do you think its OK to go that way?

Thanks

John

Sign in to reply to this post

Jason ByrnesWebAssist

the recordset looks correct, it may not have worked because the php server wasnt seeing the session.

Sometimes on pages that use session variables, the server needs a little kick in the right direction to see the session contents. this can be done by adding the following code at line 1 of your page:

php:
<?php @session_start(); ?>
Sign in to reply to this post

john70964

Thank Jason
I had success with this:
SELECT * from tablename
WHERE primarykey = (SELECT MAX(primarykey) FROM tablename)

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