I get the following error whenever i try to send a message or i press any button on the message screen like the “send message” and “cancel”
ERROR: query failed: SELECT pnotes.id, pnotes.user, pnotes.pid, pnotes.title, pnotes.date, pnotes.message_status, IF(pnotes.user != pnotes.pid,users.fname,patient_data.fname) as users_fname, IF(pnotes.user != pnotes.pid,users.lname,patient_data.lname) as users_lname, patient_data.fname as patient_data_fname, patient_data.lname as patient_data_lname FROM ((pnotes LEFT JOIN users ON pnotes.user = users.username) JOIN patient_data ON pnotes.pid = patient_data.pid) WHERE pnotes.message_status != ‘Done’ AND pnotes.deleted != ‘1’ AND pnotes.assigned_to LIKE ? order by limit 0, 25
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘limit 0, 25’ at line 7
I tried sending a message from the patient portal (offsite) to the openemr. it was received nicely. I opened it and it showed it content. I wrote my message in the box and when i clicked “send message”, the error showed. But to my utter surprise, the message was delivered to the patient in the portal. Please help!!
The source of the error is from main\messages\messages.php
The $sortby and $sortorder variables are empty strings instead of proper values in your situation.
around line 392 code is as follows
$sql = "SELECT pnotes.id, pnotes.user, pnotes.pid, pnotes.title, pnotes.date, pnotes.message_status,
IF(pnotes.user != pnotes.pid,users.fname,patient_data.fname) as users_fname,
IF(pnotes.user != pnotes.pid,users.lname,patient_data.lname) as users_lname,
patient_data.fname as patient_data_fname, patient_data.lname as patient_data_lname
FROM ((pnotes LEFT JOIN users ON pnotes.user = users.username)
JOIN patient_data ON pnotes.pid = patient_data.pid) WHERE pnotes.message_status != 'Done'
AND pnotes.deleted != '1' AND pnotes.assigned_to LIKE ?".
" order by ".add_escape_custom($sortby)." ".add_escape_custom($sortorder).
" limit ".add_escape_custom($begin).", ".add_escape_custom($listnumber);
My guess is that the http request is not being properly formed and is passing in empty strings for sortby and sortorder.
-Kevin Yeh kevin.y@integralemr.com