I have a Master-detail form where I update the total from the detail form on the master form. I am normally using a fk_ in front when naming all my foreign keys in my database. Unfortunately, I messed it on one of my detail columns in this app.
The detail field, which also links the master-detail form is “financial_transaction_id” but should have been “fk_financial_transaction_id”
I have changed my database and the WHERE clause in the PHP metode in the detail form:
sc_lookup(rs, “SELECT SUM(amount * is_credit_v) from financial_journals WHERE financial_transaction_id={financial_transaction_id}”);
if(!isset({rs[0][0]}) || empty({rs[0][0]}))
{
{rs[0][0]} = 0;
}
sc_exec_sql(“UPDATE financial_transactions SET balance_chk = " . {rs[0][0]} . " WHERE financial_transaction_id = ‘{financial_transaction_id}’”);
$total = number_format({rs[0][0]}, 2, “.”, “,”);
sc_master_value(‘balance_chk’, $total);
But then I get the following error when I try to add, delete or update a field in the detail form:
pg_query(): Query failed: ERROR: syntax error at end of input LINE 1: ... from financial_journals WHERE fk_financial_transaction_id= ^
Undefined property: financial_journals_form::$financial_transaction_id
pg_query(): Query failed: ERROR: current transaction is aborted, commands ignored until end of transaction block
Error while accessing the database
ERROR: current transaction is aborted, commands ignored until end of transaction block
{SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID}UPDATE financial_transactions SET balance_chk = 0 WHERE fk_financial_transaction_id = ''{SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END}
The app, which I have described earlier can be studied here:
i would really appreciate your help on this matter