function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sean_at_33050sean_at_33050 

iterate through getupdatedresult in PHP

Very simple question:
I have the follwing:
Code:
$startDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 01, 2006)); 
$endDate = date('Y-m-d\TH:i:s.000+00:00', mktime(0, 0, 0, 11, 15, 2006)); 
echo $startDate ."<br>";
echo $endDate ."<br>";

$result = $mySforceConnection->getUpdated('Batch__c',$startDate, $endDate );
print_r( $result );

 
which produces something like this:
Code:
stdClass Object
(
    [ids] => Array
        (
            [0] => a00300000...
            [1] => a00300000....
            [2] => a003000000...

 
(the "a003000.." being real salesforce object Ids)
 
Can someone post an example PHP code segment that "gets the ids" from $result object?
 
Here's what I tried so far:
Code:
if (is_array($result)) { // <- never true—
    $resultSize = count($result);
    for ($i = 0; $i < $resultSize; $i++) {
        echo $result[$i] ."<br>";
    }
} else {
  foreach( $result->ids as $r){
    $r = new SObject($r);
    print_r( $r ); //$n = $r->ids;
    echo "<br>";
  }
}

 
Also, anyone know of any practical ("By example" type) guides for learning to use objects?
 
Thank alot.
 
Sean
sean_at_33050sean_at_33050
This appears to work:
Code:
  foreach( $result->ids as $r){
    echo $r ."<br>";
  }