DMXzone Database Updater PHP Support Product Page

Answered

How to retrieve last insert id

Asked 05 Apr 2017 16:07:21
1
has this question
05 Apr 2017 16:07:21 Greg Hogan posted:
Using the old server behaviours you can retrieve a new record ID immediately after insertion.

e.g. // retrieves the record ID
$insert_id = mysql_insert_id();

What is the equivalent procedure using the new DMX Server Connect tools?
I can't seem to find any information on this.

thanks
Greg

Replies

Replied 06 Apr 2017 08:33:37
06 Apr 2017 08:33:37 Teodor Kuduschiev replied:
Hello Greg,
The last inserted ID is available after the insert step in server connect. You can add another step, after the insert step and you will see the identity in its dynamic data picker.
Replied 06 Apr 2017 10:01:55
06 Apr 2017 10:01:55 Greg Hogan replied:
Hi Teodor,

Thanks for that, I created a session var under "globals" then added a "set_session" step immediately after the "insert" step and this is now grabbing the inserted record ID correctly.

I first tried using the "set value" option, but I can't find how to access this value once it's assigned a dynamic data link.

Could you please advise how to use this option?

thanks

Greg
Replied 06 Apr 2017 10:28:23
06 Apr 2017 10:28:23 Teodor Kuduschiev replied:
You can assign a dynamic value to the set value step.. just add it after the insert step and you will see the identity.
Replied 06 Apr 2017 10:39:44
06 Apr 2017 10:39:44 Greg Hogan replied:
Hi Teodor,

My question was really how to access the value from the "set value" step .

In Set Value Properties, are the 'Name' and 'Global Name' fields referring to variables that need to be preset elsewhere?

thanks

Greg
Replied 06 Apr 2017 10:49:07
06 Apr 2017 10:49:07 Teodor Kuduschiev replied:
Do you want to access it on your page?
Are you using HTML5 Data Binding or DMXzone App Connect to bind your data on the page?
Replied 06 Apr 2017 10:57:46
06 Apr 2017 10:57:46 Greg Hogan replied:
Yes and I'm using App Connect.
This is a learning process as I migrate from server behaviours and understand the new methods.

Reply to this topic