Jump to content

array item not showing up


sublevel4

Recommended Posts

I have the following code

foreach($response['body']->project as $project){	  

// output only where status is active
if ($project->status == 'active'){		
	$created = $project->{'created-on'}.',';		
	$catagory = $project->company->name.',';
	$project = $project->name;
	$projectNumber = $project->id . '<br>';

	echo $projectNumber;

	$data_string .= $created . $catagory . $project. "\n";
}


}

 

if i print the array i get

[body] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [type] => array
                )

            [project] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [created-on] => 2009-11-30
                            [id] => 4038672
                            [last-changed-on] => 2009-12-21T21:02:37Z
                            [name] => Reusable bags
                            [status] => archived
                            [company] => SimpleXMLElement Object
                                (
                                    [id] => 1621970
                                    [name] =>  Marketing
                                )

                        )

 

$project comes back as Reusable bags

$created comes back as 2009-11-30

$catagory comes back as marketing

 

My problem is that $projectNumber comes back blank.

Is there something wrong with my code  that would cause this? How can i access all of other items but that one.

Any help is appreciated. Thank you!

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.