HTTP Error 500 whenever i create a hook in operational_hooks.php

Firekenny

New member

Your current DaDaBIK version​

You are using DaDaBIK version 11.8-Elba platinum, installed on 25-04-2023 (installation code: 18803644779e343e6d), the latest version of DaDaBIK is 11.9-Elba released on 23-03-2023

You are not running the last release of DaDaBIK, the release you are running might have bugs and security holes, see the official change log for further information. You can upgrade DaDaBIK here.

In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enterprise to Platinum) please contact us.

System info​

PHP Version: 8.1.18

mysql version: 10.5.19-MariaDB-cll-lve

Web server: Apache

Client: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
_______________________________________________________________________________________________________________________

I have been trying very hard to create an operational hook that is exactly following the youtube dadabik video part 4 (2017/2018).
Any kind of hooks i have been writing in the operational_hooks.php provides me with the same HTTP Error 500 message.

The hook is meant to update items balance from a table dni_release from another user entry form (table dni_release, field dni_qty_release).
If i apply the same "coding" hook from the video that supposed to update the balance my webserver provides me with http error 500. If i delete this hook ,it is back to normal.
Here is my hook:

$hooks[‘dni_release’][‘insert’][‘after’] = 'dadabik_dni_update_balance';

function dadabik_dni_update_balance($id_release)
{
global $conn;

//select the quantity in dni_release table and update the balance in dni_products table
$sql = “update dni_release INNER JOIN dni_products ON dni_release.dni_qty_release = dni_products.id_dnipro SET dni_products.dni_qty = dni_qty - dni_qty_release WHERE dni_release_id_release :id_release";

$res_prepare = prepare_db($conn, $sql);
$values_to_bind = array();
$values_to_bind[‘id_release’] = $id_release;
foreach ($values_to_bind as $key => $value)
{
$res_bind = bind_param_db($res_prepare, ':' .$key, $value);
}
$res = execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
 

eugenio

Administrator
Staff member
This has been solved after opening an email support ticket, the code contained parse errors.
 
Top