access $data array

Questionsaccess $data array
Fabian asked 3 years ago

Hello please help me,

I know, that I can access data of acutall object by $data array.
The string returned by phpgrid_error($data) looks like this:

"Array ( [idHardware] => 135 [params] => Array ( [idHardware] => [Artikelbezeichnung] => frfref"

I want to get "135" back from [idHardware], but this value is empty under $data["params"]["idHardware"]
How can I access $data[0] (int index doesn't work)

4 Answers
Abu Ghufran answered 3 years ago

For ID of grid, You can get value by:
$data["idHardware"]

It is not passed in params.

Fabian answered 3 years ago

Thanks for your quick response!
That is what I tried first, but $data["idHardware"] delivers an empty string when I output it trough phpgrid_error($data["idHardware"]);

Any tips why?

Abu Ghufran answered 3 years ago

Perhaps, I don't understand. If the string returned by phpgrid_error($data) looks like this:
"Array ( [idHardware] => 135 [params] => Array ( [idHardware] => [Artikelbezeichnung] => frfref"

Then it is obvious that $data[idHardware] should be 135.
Can you recheck?

Fabian answered 3 years ago

I tried this in sql query and it returned the correct string. Thanks for that! Only phpgrid_error($data["idHardware"]); doesn't show any value, don't now why.
Problem solved.

Your Answer

5 + 20 =

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?