Hello,
I am currently working on a project using Scriptcase where I have a form for patient registration. All patient data is being inserted into a single MySQL table named patients
, which has a primary key patient_id
set to auto-increment. The form does not utilize any events or AJAX events. However, I am encountering an issue where, occasionally, when registering a new patient, the data of all previously registered patients in the patients
table is overwritten with the information of the most recently added patient.
This issue occurs once or twice a day randomly, and it is important to note that the patient_id
remains unique and correctly increments, but all other data fields are replaced with the latest patient’s information. Could you please assist in resolving this issue?
If this is just a generated form based on a table, then this is a very odd issue I have never encountered. It is also not a very logical error, as you require an update statement and not an insert to alter all data in other records. Therefore I have a feeling that you need to look at your database if there is not a kind of process causing this issue. I.e. stored procedures etc.
Thanks Albert,
You’re absolutely right. I can confirm that I’ve been working with Scriptcase since 2014, and this is the first time I’ve encountered something like this. I’ve checked the database multiple times—it’s just a normal MySQL table with no stored procedures or functions. The form itself is simply a generated form based on the table.
I find this a quite scary and actually disturbing, especially if it is an older application migrated. If the form is pretty simple, you can consider to recreate it under a different name. Then use kdiff3 or similar to see if you can find the differences in the source code. That could be important to exclude the risk of having the same issue on other tables. To have all records modified on an insert, is simply weird to put it nicely.
which version of scriptcase are you using? perhaps, try updating the production environment? Scriptcase Download Add-ons | PHP code generator | Forms and Reports Builder
I haven’t run into this kind of issue with scriptcase form app (I’m running v9.11.016)
Check if the user may have edited an already created record and modified its data thinking they were entering a new one. you can check it in the LOG table
Last version, last update.
Hello alvagar,
If this happen then it should replace only one row, right? but it can not replace all rows in the table.
This behavior is very serious, it scares me a lot that it could happen to my users too.
Last year, I encountered an issue where a form’s single integer field was configured as a dropdown allowing multiple selections. Upon saving a record, it behaved as you’ve described: it updated all previous rows in the table with the current record’s data. To resolve this, I restored the table from a backup and modified the field to accept only a single dropdown value, which corrected the problem. I didn’t report this at the time, but seeing your post, it does appear to be a bug in Scriptcase forms.
Hello Ken,
Thank you for your feedback. I have two fields that allow multiple selections: double select and multiple checkboxes. This bug is really serious, and dealing with it feels like a nightmare.
I would test your Database using a ODBC connector to MS access or EXCEL and try in putting through this method leaving out SC altogether