Jump to content

Objects and Assigning A Value Query


MoFish
Go to solution Solved by CroNiX,

Recommended Posts

Hi,

 

I have the following code which works well.

$this->data['results'] = $this->domain_status_model->get();
foreach($this->data['results'] as $result){
  $result->domainstatus_items = $this->domain_model->get_by_status($result->domainstatus_id);

I would like the ability to target my array a little more specifically. I therfore am trying to replace the domainstatus_item portion using a returned value from another query. When I try this, it does not appear to be working, probably due to a simple mistake. I have tried using . + and & operators in order for it to work, however am not having much success.

$this->data['results'] = $this->domain_status_model->get();
foreach($this->data['results'] as $result){
  $result->domainstatus_$result->domainstatus_title = $this->domain_model->get_by_status($result->domainstatus_id);

In summary, the value returned from $result->domainstatus_title is for example 'pending' and I am trying to get the following:

$result->domainstatus_pending = $this->domain_model->get_by_status($result->domainstatus_id);

Any help would be much appriciated. ::)

 

Kind regards,

 

MoFish

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.