[SOLVED] mysql_insert_id(); returning a 0 for auto-increment value

I am trying to store the [ticketID] = mysql_insert_id(); in the OnAfterInsert event on my form application. However, the value of ticketID is returning 0 yet the database insert is correct and the ticketIDs in the datbase table are incrementing correctly. I am using version 6.x - is this a bug? Does anyone know how to resolve this issue?

Re: mysql_insert_id(); returning a 0 for auto-increment value

Hello,
I had the same problem … and I know the solution …:slight_smile:

Scriptcase does not support mysql_insert_id() because SC is not specific to a special database.
Do the following:

Event : OnAfterInsert

// Customer_ID is the Primary key of the table, where the record is inserted …
$new_value = {Customer_ID};

Thats all …

Best regards
Uwe Pfeiffer

Re: mysql_insert_id(); returning a 0 for auto-increment value

Thanks that worked. Much appreciated!