D
|
Dale 4/7/2007 |
Here's the snippet I use when adding a new customer. |
K
|
karen price author 4/9/2007 |
Thanks Dale. Here's the snippet I use when adding a new customer. I use it in the AFTER ADD events of the table I need to know the last created Id. global $conn; $str2 = "select LAST_INSERT_ID() from `customer`"; // Replace `customer` with your table name $rs2 = db_query($str2,$conn); $data2 = db_fetch_numarray($rs2); $_SESSION["last_inserted_row"] = $data2[0]; return true; Hope this helps |
K
|
karen price author 4/9/2007 |
This is the code I used to obtain the last record of my database. I have a AUTO_INCREMENT field called ID. |
J
|
Jane 4/9/2007 |
Hi, function AfterAdd() { global $conn; $str2 = "select last_insert_id() from quotation"; $rs2 = db_query($str2,$conn); $data2 = db_fetch_array($rs2); echo "last inserted row is ".$data2[0]; } |
K
|
karen price author 4/9/2007 |
Hi Jane, Hi, you can use LAST_INSERT_ID() function in the After record added event only. Here is the correct code: |
J
|
Jane 4/10/2007 |
Hi, |