Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
weswhite7 #1
Getting the ID you just wrote to a table with
Just curious on how to do something when I'm writing with one form, to two
different tables. I have the unique id that increments in the first table. The
problem is in the second table, it's not auto increment. I'm curious on how to
get that unique id on the first table, set that with cfset, and then insert
that into the id field on the second insert query.
Any help??
Wes
weswhite7 Guest
-
any of you ever wrote a get_next_id function?
function getNewID($fieldName, $tableName) { // INT "METHOD" FOR NON-AUTO-INCREMENT FIELDS global $dbConn; $sql = "SELECT MAX($fieldName) FROM... -
#25473 [Fbk->Opn]: Updating single row in table causing all rows in table to be updated.
ID: 25473 User updated by: jim at bluedojo dot com Reported By: jim at bluedojo dot com -Status: Feedback +Status: ... -
#25473 [Opn]: Updating single row in table causing all rows in table to be updated.
ID: 25473 User updated by: jim at bluedojo dot com Reported By: jim at bluedojo dot com Status: Open Bug Type: ... -
#25473 [NEW]: Updating single row in table causing all rows in table to be updated.
From: jim at bluedojo dot com Operating system: WinXP PHP version: 4.3.3 PHP Bug Type: MySQL related Bug description: ... -
Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table.
We are getting this error after clearing the web.config of database infomation - even after using the wizard to re-enter the information. I could... -
JMGibson3 #2
Re: Getting the ID you just wrote to a table with
<cftransaction>
<cfquery ......... INSERT ..... </cfquery>
<cfquery name="selqry" SELECT Max(ID) as MaxID </cfquery>
<cfquery ......... INSERT .... Values (#selqry.MaxID#, ....) </cfquery>
</cftransaction>
cftransaction will both isolate your query set from other activity and also
RollBack everything should one of the pieces fail.
JMGibson3 Guest
-
mxstu #3
Re: Getting the ID you just wrote to a table with
If you are using SQL Server or Access, you may also want to take a look at this link [url]http://www.houseoffusion.com/cf_lists/messages.cfm/forumid:4/threadid:34151[/url]
mxstu Guest



Reply With Quote

