You need to sign in to do that
Don't have an account?

Fatal error: Class 'QueryResult' not found
Hi
i know it's something basic but i don't understand :(
i get this error
Fatal error: Class 'QueryResult' not found in C:\scripts\index.php on line 12
from this code:
require_once("c:/php/sforce/soapclient/SforceEnterpriseClient.php");
require_once ('c:/php/sforce/soapclient/SforceHeaderOptions.php');
require_once ('c:/php/sforce/userAuth.php');
$conn= new SforceEnterpriseClient();
$conn->createconnection("enterprise.wsdl.xml");
$mylogin=$conn->login($myusername,$mypassword);
$query="select firstname,lastname,email from contact where username__c='abcdefgh'";
$response=$conn->query($query);
$queryresult = new QueryResult($response);
foreach ($queryresult->records as $result) {
$Name= $result->fields->firstname;
print_r("
name is ");
print_r ($Name);
}
thanks for any help
tammy
i know it's something basic but i don't understand :(
i get this error
Fatal error: Class 'QueryResult' not found in C:\scripts\index.php on line 12
from this code:
require_once("c:/php/sforce/soapclient/SforceEnterpriseClient.php");
require_once ('c:/php/sforce/soapclient/SforceHeaderOptions.php');
require_once ('c:/php/sforce/userAuth.php');
$conn= new SforceEnterpriseClient();
$conn->createconnection("enterprise.wsdl.xml");
$mylogin=$conn->login($myusername,$mypassword);
$query="select firstname,lastname,email from contact where username__c='abcdefgh'";
$response=$conn->query($query);
$queryresult = new QueryResult($response);
foreach ($queryresult->records as $result) {
$Name= $result->fields->firstname;
print_r("
name is ");
print_r ($Name);
}
thanks for any help
tammy
First off, IMHO, I hate the entire concept of the Enterprise WDSL. So limited. You should be useing the Partner file because it doesn't need any updates performed if you change objects in your org.
So there is no object type called QueryResults, so just strip out that line and everything about your code should work.
echo "Found {$response->size} results in this query\n";
foreach ($response->records as $result) {
print_r($result);
}
Now it's possible you might need to type cast the results to get them to properly form themselves, but if I remeber correctly the Enterprise WDSL will do this for you. Try the above code, and then you can figure out what the proper names of the fields are.
All Answers
First off, IMHO, I hate the entire concept of the Enterprise WDSL. So limited. You should be useing the Partner file because it doesn't need any updates performed if you change objects in your org.
So there is no object type called QueryResults, so just strip out that line and everything about your code should work.
echo "Found {$response->size} results in this query\n";
foreach ($response->records as $result) {
print_r($result);
}
Now it's possible you might need to type cast the results to get them to properly form themselves, but if I remeber correctly the Enterprise WDSL will do this for you. Try the above code, and then you can figure out what the proper names of the fields are.
thanks much!
once i used the partner file and got the case right on the field names :) it worked!!