Jump to content

Get specific key value from stdclass object


Recommended Posts

53 minutes ago, host.mahmud said:

Please check the attached image if it is possible to get the value.

this array result is from a query of the tbladdonmodules database table - if you're creating that query yourself, then just add your two where statements into it and get the value in the result.

if you can't control the query and are just dealing with an existing array, then loop through it in a foreach loop (as usual), but reference the variables with arrows rather than square brackets, e.g $obj->module rather than $obj['module'], in an if statement...

if ($obj->module == "licensing" && $obj->setting == "clientverifytool") {
 *do something*
}

i'm unsure if you're doing this as PHP in a hook or Smarty in the template, but you can do it in either - you just need to adjust the code accordingly.

Link to comment
Share on other sites

21 hours ago, brian! said:

this array result is from a query of the tbladdonmodules database table - if you're creating that query yourself, then just add your two where statements into it and get the value in the result.

if you can't control the query and are just dealing with an existing array, then loop through it in a foreach loop (as usual), but reference the variables with arrows rather than square brackets, e.g $obj->module rather than $obj['module'], in an if statement...


if ($obj->module == "licensing" && $obj->setting == "clientverifytool") {
 *do something*
}

i'm unsure if you're doing this as PHP in a hook or Smarty in the template, but you can do it in either - you just need to adjust the code accordingly.

Hi Brian, Thanks for the suggestion. I already fix it in different way using Capsule. 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated