Skip to main content
Topic: Error on using Update query in "Action After View" (Read 1958 times) previous topic - next topic

Error on using Update query in "Action After View"

Hello! I'm new user in this important tool. I am using XAMPP (PHP and MySQL with apache server).  I can access the bank and show the results in the "LIST" area. But I'm trying to do the following:

When user go to "VIEW" (details of the record) the script update a database to save the active user name to an field. So I can know who accessed this record.  For this I use the following code in the "Action After View" section :

Code: [Select]
$ActiveUser = ucwords(USER_NAME);
$my_id         = $rec_id;
$db->rawQuery("UPDATE mail SET gc_receivedByName='$ActiveUser' WHERE gc_id='$my_id'");

mail -> is my table name.
gc_receivedByName-> is the field that I want to perform the update (belongs to mail table)
$ActiveUser -> gets the name of the logged user
gc_id -> is an another field of the mail table
$my_id -> is the  $rec_id

When executing this code the database is updated correctly. There are no mistakes in the DB. However When i are going to a "View" page (record details)iI get the following error (in admin panel):  !Error Processing Request.
After the error, no data is obtained from the database.  Inspecting the code (in browser), I get the following return: Failed to load resource: the server responded with a status of 500 (Internal Server Error).

Referring to the following location:
http://localhost/mysite/mail/view/1.  If I delete the code from the "Action After View" section all results are retrieved from the database without any problem. The only difference I noticed between the two addresses (the address with the update code and the address without the update code) was the following:

With the update query: The link shown in the browser inspector is http://localhost/mysite/mail/view/1 (no data obtained from the database)
With no update query: The link shown in the browser address bar is: http://localhost/agenciavirtual/#/mail/view/1 (data is obtained normally)

Can someone help me?


Re: Error on using Update query in "Action After View"

Reply #1
Hi
Apologize for the late reply.

With regards to the your issue,

This is just a bug that is introduced with the last update of the software.
Here is the work around for the now .
You can download and replace the app/models/PDODb.php with the file or from the link https://phprad.com/appdata/PDODb.zip. That should fix the problem.

Our next update with take care of the issue.

Thanks for your great support.

Best Regards.