Skip to main content
Angell EYE
Inspiring
November 17, 2007
Question

PHP Insert Record...Need to then grab ID of new record

I'm using DW's Insert Record behavior with my registration form. I'd like to be able to then grab this new ID that was just created. If I add the PHP to do this ($CustomerID = mysql_insert_id();) into the behavior code, though, it breaks the behavior inside of DW.

The code actually will work if I run it but then everytime I ever edit this Insert Record behavior I to remove the code I added so the Insert Record behavior shows up again, then make my changes, and then add the code back when I'm done. Very annoying.

I could just write my own insert statements and not use the behavior but if there's a way around this problem I'd really rather stick to using DW's tools. That's why I use DW to begin with.

Any information would be greatly appreciated. Thanks!
This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

Inspiring
November 17, 2007
"Angell EYE" <webforumsuser@macromedia.com> wrote in message
news:fhm510$71i$1@forums.macromedia.com...
> I'm using DW's Insert Record behavior with my registration form. I'd like
> to
> be able to then grab this new ID that was just created. If I add the PHP
> to do
> this ($CustomerID = mysql_insert_id();) into the behavior code, though, it
> breaks the behavior inside of DW.
>
> The code actually will work if I run it but then everytime I ever edit
> this
> Insert Record behavior I to remove the code I added so the Insert Record
> behavior shows up again, then make my changes, and then add the code back
> when
> I'm done. Very annoying.
>
> I could just write my own insert statements and not use the behavior but
> if
> there's a way around this problem I'd really rather stick to using DW's
> tools.
> That's why I use DW to begin with.
>
> Any information would be greatly appreciated. Thanks!

You'd have to edit the edml file in your dreamweaver configuration and
add an updatePatterns section in
"$dreamweaver\configuration\ServerBehaviors\PHP_MySQL\UpdateRecord_main.edml"

Updating server behaviors
http://livedocs.adobe.com/dreamweaver/8/extending/16_ser82.htm
--
Joris van Lier

Translate
Angell EYE
Inspiring
November 17, 2007
I'm not sure I understand this. Is there a way I can just get the Insert Record behavior to always add

$MM_NewRecordID = mysql_insert_id();

Just as if it was built in to begin with...???
Translate