J
|
Jane 4/13/2007 |
Hi, function AfterAdd() { global $strTableName,$conn; $str = "select LAST_INSERT_ID() from ".$strTableName.""; $rs = db_query($str,$conn); $data = db_fetch_numarray($rs); $_SESSION["CompanyID"]= $data[0]; } |
![]() |
Alexey admin 4/13/2007 |
Hi, function AfterAdd() { $_SESSION["CompanyID"]= mysql_insert_id(); } |
D
|
dlpirl author 4/13/2007 |
Hi, there is an easier way to obtain last inserted ID. Here is the code:
@$_SESSION[$strTableName."_masterkey1"]
if(@$_SESSION[$strTableName."_masterkey1"],@$_SESSION[$strTableName."_masterkey1"],@$_SESSION["CustomerID"])
for the CustomerID. |
![]() |
Sergey Kornilov admin 4/13/2007 |
Donald, |
D
|
dlpirl author 4/13/2007 |
Donald, you need to execute this code in some other place (Event) and assign the value to some Session variable. After that you can use this Session variable as a default value. Thanks, I'll think about how to do it that way. |
|
hanb 11/5/2007 |
Hi, there is an easier way to obtain last inserted ID. Here is the code:
|
J
|
Jane 11/6/2007 |
Han, $_SESSION["CompanyID"]= mysql_insert_id(); |