salesforce - PHP Query error stdClass Object ( [Id] => ) -


i'm executing query on php:

$query = 'select email__c, firstname__c user__c';  $result = $mysforceconnection->query($query);  for($i = 0; $i < count($result->records); $i++) {   print_r($result->records[$i])."<br/>\n";    echo("<span>done</span><br/>\n"); } 

i have 2 elements in database , output is:

done done 

how can print values?

salesforce returns array of objects, try instead:

$i=0; foreach ($response->records $record) {     $i++;     echo "\n".$i.": \n";     print_r($record);     echo "the id is: ".$record->id."\n"; } 

another point remember salesforce query results if field empty won't return in object, may need this:

if (isset($record->name)) { echo "the name $record->name\n"; } else { echo "name blank\n"; } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

django - CSRF verification failed. Request aborted. CSRF cookie not set -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -