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
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
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.
Thanks Jason
Sounds excellent.
Will have a go!
Regards
John
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
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
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 @session_start(); ?>
Thank Jason
I had success with this:
SELECT * from tablename
WHERE primarykey = (SELECT MAX(primarykey) FROM tablename)
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.