Read about OpenEMR's Response to the COVID-19 Pandemic at

Query Error when creating Lab Requisition

I have a patient that I am attempting to create a lab requisition from an ordered proceedure. The frame instead of showing the req displays Query Error.

OpenEMR Version
I’m using OpenEMR version 5.0.2 (1)

I’m using: Chrome/MacOS; Firefox/MacOS

Operating System
I’m using: Apache 2.4

Did you check the logs? Was there anything pertinent in them? Paste them here (surround with three backticks (```) for readability

Did not have a php error in the php error log.

Hi @kevin_ytc, please post the details of the query error, thank you.

Where do I find those? That is where I am stuck…thanks!

gotcha, try Admin->Globals->Logging-> User Debugging Options

another nice add from @sjpadgett

Ok, I set errors to all and get nothing! :slightly_smiling_face:

Seems now that the procedure I have loaded, CBC, is not showing as a selection to search for when ordering the procedure (its the only one I have a test as we are figuring what we need to order).
So, now there is no order ID for the Lab REqusition to find to even attempt a PDF.

Additionally, I now get this pulling up an old encounter form.

could you post a shot of your procedure configuration?

If the Header class is not loaded in form/script the User Debug won’t work

1 Like

The first one CBC, is the only one that used to show when adding a proceedure when searching favorites. The second one, CBC no diff, does not show up at all. Now, both don’t show up when adding a procedure. Either for my as Admin or the Physician profile.

I’m going to run a fresh install and see if there are any issues along these same lines. I’ll keep you posted.

How would I know if that is running? Is it the _header.php file that should be called from the Form.php?

Both procedure form and configuration loads user debug. So not popup, prob not getting errors.
A couple things.

  • Ensure your orders in configuration have a correct Order From provider setup.
  • Ensure code is populated
  • Check provider setup Procedure->Provider.
  • Address Book needs entry for lab type of provider used in provider setup.

This is all so even if internal clinic.

Ok, so I got the procedure to load again and populate into the procedure order form. The group CBC was still not available to grab and then populate the RBC and WBC tests (like had been done) but I can add tests and record the results.

However, I still can’t generate the lab requisition form… my guess is that it is not in the form itself, but one of the module loads (barcode, etc…)

Attached some screen shots…

Procedures are working fine, second part to this is the query error when attempting to load a lab requisition form.

Found that the load_form.php is attempting to load the requisition form, but I don’t know how it is called in either the load_form or forms code.

Annddd… I did some more testing and cut out the barcode portion of the requisition


and the lab requisition form works now. So, something in the barcode.php is not working.

focus narrows

1 Like

there’s been some recent work on pdf parsing to html, wonder if this is the culprit

I’m going to look at the barcode.php this weekend and see if I can see what could generate a query error. I know that I have having a problem with the Zend HTML and PDF print module for Rxs, so…

Annnd I have no idea where the query error would be in barcode.php… does it call another function?

hi @kevin_ytc, we could look at the HelpfulDie function to see why it’s not spitting out the details of the sql error. Is your Admin->Globals->Security set up for Mode - Do Not Show SQL Queries ?

you could stick an error_log call in there to display the statement if needed

Found it!

126 [Fri Feb 14 20:51:24.125087 2020] [php7:notice] [pid 19335] [client] SQL Error with statement:que ry failed: SELECT req_id FROM requisition WHERE lab_id = ? AND pid = ?–Table 'openemr-test.requisition' d oesn't exist==>/var/www/openemr/library/ at 139:sqlQuery, referer: erface/patient_file/encounter/encounter_top.php?set_encounter=16

That seems to be the error…

nice, so guessing when you installed the form through Admin->Forms the table wasn’t built correctly?

I didn’t remember any errors? I also get a popup php error, i’ve included it elsewhere, but it says the following

That for each proceedure order that it build out when creating the Frame. However, that is only after a proceedure order has been saved… a new encounter loads correctly.

So, my thinking was that there was something squirly with the lab ID and pid, since that is called in the barcode.php… seems that with that sql error, that is exactly what is going on,.

What should the table structure look like?
Would disabling / reenabling work?