Add generated record number to an additional field upon INSERT INTO

5 posts by 2 authors in: Forums > CMS Builder
Last Post: January 22, 2015   (RSS)

By claire - January 22, 2015

Not sure what you mean here - you need the record num to be saved into its own record?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By nmsinc - January 22, 2015

Correct,  I need it in addition to the "num" field!

Thanks - nmsin

nmsinc

By claire - January 22, 2015

Okay, you'll need to add this line after your code:

$userNum = mysql_insert_id();
mysql_update('background', $userNum, null, array('file_number' => $userNum));

And then remove the line referencing file_number from the actual query.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By nmsinc - January 22, 2015

Thanks Claire - worked great!

nmsinc

nmsinc