You need to sign in to do that
Don't have an account?
Object problems?
I have got a connection to the phptool kit ok...
but pulling objects and information out of the database is causing some problems
Pixpay_Registration_Voucher__c
Array
(
[0] => SObject Object
(
[type] => Pixpay_Registration_Voucher__c
[fields] => stdClass Object
(
[OwnerId] => 00520000000vSAA2
[IsDeleted] => false
[Name] => 716851737094758719
[CreatedDate] => 2008-10-09T16:05:14.000Z
[CreatedById] => 00520000000vFALAA2
[LastModifiedDate] => 2009-01-20T17:31:04.000Z
[LastModifiedById] => 00520000000vFALAA2
[SystemModstamp] => 2009-01-20T17:31:04.000Z
[LastActivityDate] =>
[Voucher_Status__c] => Sample
[Activation_Date__c] =>
[Value__c] => 20.0
[Voucher_Brand__c] => Ucash
[Currency__c] => GBP
[Application_Number__c] =>
[Agent_Name__c] =>
)
[Id] => a0A20000002ERGHEA4
)
)
Id = a
OwnerId =
Name =
CreatedDate =
CreatedById =
LastModifiedDate =
LastModifiedById =
SystemModstamp =
LastActivityDate =
LastModifiedById =
Voucher_Status__c =
Activation_Date__c =
Value__c =
Voucher_Brand__c =
Currency__c =
Application_Number__c =
Agent_Name__c =
SCREEN PRINT
database table scan
for some reason its just pulling out the first letter of the id?
//Attachment echo'<br/><b>Pixpay_Registration_Voucher__c</b><br/>'; $query = "SELECT Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, LastActivityDate, Voucher_Status__c, Activation_Date__c, Value__c, Voucher_Brand__c, Currency__c, Application_Number__c, Agent_Name__c from Pixpay_Registration_Voucher__c ORDER BY LastModifiedDate LIMIT 1"; $queryResult = $mySforceConnection->query($query); $records = $queryResult->records; //print_r($records); print_r($records); echo'<br/>'; foreach ($records as $record) { $sObject = new SObject($record); } foreach ($records as $record) { $sObject = new SObject($record); echo "<br/>Id = ".$sObject->Id.""; echo "<br/>OwnerId = ".$sObject->fields->OwnerId.""; echo "<br/>Name = ".$sObject->fields->Name.""; echo "<br/>CreatedDate = ".$sObject->fields->CreatedDate.""; echo "<br/>CreatedById = ".$sObject->fields->CreatedById.""; echo "<br/>LastModifiedDate = ".$sObject->fields->LastModifiedDate.""; echo "<br/>LastModifiedById = ".$sObject->fields->LastModifiedById.""; echo "<br/>SystemModstamp = ".$sObject->fields->SystemModstamp.""; echo "<br/>LastActivityDate = ".$sObject->fields->LastActivityDate.""; echo "<br/>LastModifiedById = ".$sObject->fields->LastModifiedById.""; echo "<br/>Voucher_Status__c = ".$sObject->fields->Voucher_Status__c.""; echo "<br/>Activation_Date__c = ".$sObject->fields->Activation_Date__c.""; echo "<br/>Value__c = ".$sObject->fields->Value__c.""; echo "<br/>Voucher_Brand__c = ".$sObject->fields->Voucher_Brand__c.""; echo "<br/>Currency__c = ".$sObject->fields->Currency__c.""; echo "<br/>Application_Number__c = ".$sObject->fields->Application_Number__c.""; echo "<br/>Agent_Name__c = ".$sObject->fields->Agent_Name__c.""; } echo'<br/>SCREEN PRINT<br/>';
I am not sure what the problem is... I've got the code on a new server and I swear its set up on soap etc...
what could be missing, it seems to have a problem picking out the object?
$sObject = new SObject($record);
is the problem here. You can just use the $record (in the for-loop) directly without wrapping to a sObject. So :
echo "<br/>Id = ".$sObject->Id."";
[...]
}
best wishes
Carsten Harnisch
Yep -- one more way you can fetch the data.
foreach($queryResult->records as $key => $object){
echo ( '<br>Id:' . $object->Id);
.......
}