PHP Error Log

question

#1

Trying to out how to fix this. Any suggestions?
Apache 2.4.18
PHP 7.0.4
MySQL 5.7.11

[10-May-2017 16:12:10 America/New_York] SQL Error with statement:query failed: select distinct billing.id, form_encounter.date, billing.pid, billing.code_type, billing.code, billing.user from form_encounter, billing, patient_data, claims, insurance_data where billing.encounter = form_encounter.encounter and billing.pid = form_encounter.pid and patient_data.pid = form_encounter.pid and claims.patient_id = form_encounter.pid and claims.encounter_id = form_encounter.encounter and insurance_data.pid = form_encounter.pid and insurance_data.type = ‘primary’ AND (form_encounter.date between ‘2017-04-25 00:00:00’ and ‘2017-04-25 23:59:59’) AND (patient_data.fname like ‘Georgina Williams%’ or patient_data.lname like ‘Georgina Williams%’) AND form_encounter.pid in (Williams) and billing.code_type like ? and billing.activity = 1 order by billing.pid, billing.date ASC–Unknown column ‘Williams’ in ‘where clause’==>C:\emr_wamp\www\openemr\library\billrep.inc at 178:sqlStatement


#2

Hi @juggernautsei ,

Is this a customized sql query? the “form_encounter.pid in (Williams)” part is very odd. Rather than a patient name, that should be a pid number in the parenthesis.

-brady


#3

I have not changed anything in the system. I have been checking our error logs since upgrading to 5.0.3. This came up yesterday. I am not real familiar with this section so that is why I posted it. Yes, I agree with you and I was wondering if there was a flaw in what the user did and not the system.

I was able to recreate the error just now. It was that the EU selected Patient ID as criteria for the report and typed in the name Williams. So the query does throw an error when EU does that.


#4

@Brady @robert,
On this one a @Shiva sent me a fix for this issue. Since the EU typed in letters where there should be only numbers. Shiva added a javascript to the page to prevent this from happening. I sure may not happen often but to prevent the possibility may be worth bring it into the code?

Your thoughts…


#5

@juggernautsei ,
Definitely place a PR for this (and any other code). Worst case is it doesn’t get into the codebase (and even in that case it will likely provider inspiration for a better fix or other fixes).
-brady