Page 1 of 1

PHP 8.2.24 Fatal Error

Posted: 2024-10-09 18:14
by srenshaw
My Webhost recently updated to PHP version 8.2.24 and I'm now experiencing an error when I try to update a record - the page does not refresh and the following error is logged:


[09-Oct-2024 18:15:05 Europe/London] PHP Fatal error: Uncaught TypeError: mysqli_fetch_row(): Argument #1 ($result) must be of type mysqli_result, bool given in /**DB_Path**/db.php:65
Stack trace:
#0 /**DB_Path**/db.php(65): mysqli_fetch_row(true)
#1 /**DB_Path**/admin/incFunctions.php(469): db_fetch_row(true)
#2 /**DB_Path**/hooks/XmasOrders.php(406): sqlValue('UPDATE XmasOrde...')
#3 /**DB_Path**/XmasOrders_dml.php(328): XmasOrders_after_update(Array, Array, Array)
#4 /**DB_Path**/datalist.php(349): XmasOrders_update('897', '')
#5 /**DB_Path**/XmasOrders_view.php(361): DataList->Render()
#6 {main}
thrown in /**DB_Path**/db.php on line 65



My code on line 406 in the XmasOrders.php Hook file referred to above is:

sqlValue("UPDATE XmasOrders SET SendEmail02='0' WHERE ID=$OrderID");


When I roll back the PHP version to 7.4.33, the are no errors and the order page refreshes correctly.


Any help would be greatly appreciated.

Re: PHP 8.2.24 Fatal Error

Posted: 2024-10-09 19:18
by jsetzer
For update, insert and delete SQL commands, try replacing sqlValue() function call (which is meant for fetching data) by sql() function call.

That change helped me in the past.

Also, I recommend adding the 2nd $error parameter for evaluating errors, if any.

Re: PHP 8.2.24 Fatal Error

Posted: 2024-10-10 10:05
by srenshaw
That fixed it - many thanks!!