V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Hello,
I use MySQL with a MYISAM-Table and an integer field with autoincrement as Primary key.
In V6 I put the following code in the form in the

OnafterInsert - event.
$last_id = mysql_insert_id();
die ("Last value of ID : $last_id ");

In V5 I get the correct value of the latest ID in the table.
In V6 the result is 0.

I posted this bug to support…

Best regards
Uwe

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Meanwhile the developer accepted this to be a bug in SC 6.
So be careful, if you use this function of mysql.

Maybe they repair this bug in next release…
Best regards
Uwe Pfeiffer

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Hi,
just my experience.
I’m using this function on MySQL (InnoDB) but it is called in a php-method right after the insert command without using the scriptcase events and it is working flawlessly. May be it has something to do with the event handling and it gets lost somewhere ;-).
Hope this helps.
Stefan

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Yes, of course it’s a problem of eventhandling in SC &. In SC 5 it’s no problem…
Because my insert command is controlled by SC (new record in form) I can only use the OnAfterInsert-Event to
go on.

Thanks
Uwe

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

I have the same problem.
someone has resolved it??

can you tell me a workaraound??

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Hi mxsx,
as I mentioned before, I have created my own button to insert a new record and call the mysql_insert_id() function right after the insert command.

i.e.

$success=mysql_query(‘INSERT INTO …’);
if($success)
{
$last_id=mysql_insert_id();
}
else
{
error-message, redirect, …;
}

Hope that helps
jsb

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

The support of scriptcase says it’s a bug. I don’t want to create my own insert function … otherwise I don’t know why I buy a software.
This error is known more than two weeks but nothing is fixed.
More and more I’m dissapointed concerning the support… I only get answers like … we have a new ticket system and we have to follow our instructions … ?
I never had such a bad support in other applications … Meanwhile I regret that I bought scriptcase.
There are other severe bugs in SC V6… so the editor for functions often collapses and the code is lost.
This error is too known more than 2 wekks and nothing happens.
Scriptcase is a professional software … I wonder…

Regards
Uwe Pfeiffer

Re: V6 - 6.00.0016 mysql_insert_id() in OnAfterInsert-Event in a form returns 0

Hi Uwe,
you are totally right (support sucks) and I don’t argue with most of your assumptions but mxsx was asking for a workaround and this one works.

Later on
jsb