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
https://forums.phpfreaks.com/topic/268295-array-item-not-showing-up/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.