sqlLastID() help

cbezuidenhout wrote on Tuesday, January 17, 2012:

Hi all, trying to get the last inserted ID for use in a linking table,

I tried sqlInsert() to apply the insert statement.
but it returned a number in the thousands, the id of the inserted field was 32

I then tried sqlStatement() followed by sqlLastID() which also returned a number in the thousands.

any ideas on how to get sql last insert ID ?

thanks

  - Craig
    - Tajemo Enterprises

bradymiller wrote on Tuesday, January 17, 2012:

Hi,

To further debug, disable Administration->Globals->Logging->‘Enable Audit Logging’, and let us know if that fixed it.

-brady

cbezuidenhout wrote on Tuesday, January 17, 2012:

Hi Brady,

yes that fixed the issue, but not sure if disabling Audit Logging is a good thing to be doing ?

yehster wrote on Tuesday, January 17, 2012:

Craig,
You are running into a bug with the audit logging that exists, but we haven’t been able to fully characterize.

What operating system version, php version, apache version and mysql version are you using?

Also, I’m guessing/hoping that you are working with 4.1.0 code (patched or otherwise) because there are changes in the 4.1.1 development code branch that we were hoping fixed this audit log bug.

cbezuidenhout wrote on Tuesday, January 17, 2012:

interesting, works on our production which is :
  - debian server
  - PHP Version 5.3.3-7 
  - Apache/2.2.9

my development machine (it needs audit disabled) is :
  - Windows 7
  - WAMP 2.0
  - PHP ver
  - PHP Version 5.3.8
  - Apache/2.2.21

both run openEMR v4.1.0  patch 6

but at least we know how to test it.

Thanks.

yehster wrote on Tuesday, January 17, 2012:

Craig,
Here is another thread discussing the bug in a different context
https://sourceforge.net/projects/openemr/forums/forum/202505/topic/4782368
I think/hope that the updated adodb work that is in the 4.1.1-dev code base will address the problem
https://sourceforge.net/projects/openemr/forums/forum/202506/topic/4877666
If you haven’t started working with git yet I think it would be helpful to you, so you can both try out other people’s code and share yours.
http://open-emr.org/wiki/index.php/Git_for_dummies

cbezuidenhout wrote on Tuesday, January 17, 2012:

Thanks yehster

looking into all of the links, also had intended to register for GIT anyway so that I can start contributing.

cheers

yehster wrote on Friday, January 27, 2012:

Craig,
I’m curious if you’ve discovered anything additional about the sqlInsertID issue.  Do you have things working correctly under windows with audit logging or are you just running with audit logging off on your development box?

cbezuidenhout wrote on Friday, January 27, 2012:

Hi Yehster,

Nope, no such luck.

Never spent too much energy on it, as my production server is fine with audit logging enabled. So I just disable it on my personal dev machine.

  - Craig
    Tajemo Enterprises