Passing a variable to on_insert or on _update functions. How?

QuestionsPassing a variable to on_insert or on _update functions. How?
Alexander Toth asked 1 year ago

Hello Abu,

what is the correct syntax (if is possible) to pass a variable to a function with on_insert or on_update?

I tried this for example:

$e[“on_insert”] = array(“my_insert_function($_SESSION[myvalue])”, null, true);

function my_insert_function(&$data, $myvalue)
{
$data[“params”][“log_myvalue”] = $myvalue;
}

But I only get a 500 Internal server error

Thanks

1 Answers
Abu Ghufran Staff answered 1 year ago

Hello,

The event callbacks default receives required data as param.

http://phpgrid.org/docs/grid-events/

If you want to use $_SESSION in function, you can always use it as it is super global.

function my_insert_function(&$data)
{
$data[“params”][“log_myvalue”] = $_SESSION[“myval”];
}

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Your Answer

19 + 1 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?