This topic is locked

Function name must be a string

4/8/2021 3:34:04 PM
PHPRunner General questions
K
klyle author

What is the issue that causes errors like
Fatal error: Uncaught Error: Function name must be a string
thrown in buttonhandler.php on line 341 ?

I am executing some Database API queries in the button Server event.

admin 4/8/2021

This is an issue with your PHP code added to button's Server event. Inspect buttonhandler.php file to see what's in there around line 341, this will tell you what button causes this.

K
klyle author 4/8/2021

I know it has to be the last button added, but the error message doesn't help much. Here is the button code :

$rs = DB::Query("select * from StockInwardTransactionDetail where StockInwardTransactionID =" .$record([StockInwardTransactionID]));

//Execute the inventory updates in the while loop:

while( $data = $rs->fetchAssoc() )
{
DB::Query("update StockMaster set StockinUnits = StockinUnits +".$data["QtyInBaseUnit"]." where CommodityID=".$data["product_id"]);
}

This is : On button click of the TransactionMaster, query the transaction details, and adjust the Inventory by those amounts.

Is there something in the code causing this error?

K
klyle author 4/8/2021

Line 341 is the update statement. I see that there appears to be an error the syntax at the end.

K
klyle author 4/8/2021

Sorry 341/342 is the first Select statement.

admin 4/9/2021

Incorrect:

$record([StockInwardTransactionID])

Correct:
$record["StockInwardTransactionID"]