$Data is empty

Questions$Data is empty
Sven asked 6 years ago

$col=array();
$col[“title”] = “ModuleID”;
$col[“name”] = “ModuleID”;
$col[“hidden”] = true;
$cols[]=$col;
$e[“on_delete”] = array(“delete_CusMod”, null, false);
$grid->set_events($e);

function delete_CusMod($data)
{

$sql = “DELETE FROM MMS_CustomModules WHERE ModuleID='”.$data[‘params’][‘ModuleID’].”‘ AND CID='”. $_SESSION[‘CID’] .”‘”;
$result = SQLQuery($sql);

}

Why is $data allways empty?

3 Answers
Sven answered 6 years ago

I have figured out that data[‘param’][‘FieldName’] is not working with “on_delete”

It must be $data[‘FieldName’], [‘param’] is not supported afaiks.

 

c3media answered 6 years ago

Hello, review your query: https://gist.github.com/colegiosdigitales/14aa9cb1fcc742e3c82874fe5861aa95

It’s necessary Table Col Name for query

Regards!

Abu Ghufran Staff answered 6 years ago

You can always debug $data passed to callbacks using:

function delete_CusMod($data)
{
phpgrid_error($data);
}

It will show $data array as error box when you delete.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

12 + 8 =

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?