You need to sign in to do that
Don't have an account?
Peter Kaye
$mySforceConnection returns a value to show a connection to the database.
Any ideas why this code fails to fill the variable $response with the number of records in the custom object Normal_Service__c ? Thanks.
Count number of records in SOQL query
$query = "SELECT count() from Normal_Service__c "; $response = $mySforceConnection->countQuery($query); print_r ($response);
$mySforceConnection returns a value to show a connection to the database.
Any ideas why this code fails to fill the variable $response with the number of records in the custom object Normal_Service__c ? Thanks.
I could not get bainesy's suggestion to work - using his SQL with countQuery produced a blank screen ( no error ). I am looking further at Harshil's code - I haven't yet managed to translate it to valid php.
This is what worked:
Just a normal query ( or queryAll) ! Interestingly replacing COUNT() with COUNT(Id) gives the record count as 1. There's lots I don't get here, not the least why countQuery doesn't work, and why putting a field name in COUNT() gives the wrong result. I'll come back to these and post again if I can get any clarification. Thanks again for your input on this.
You need to Change your Code to
$query = "SELECT count(id) from Normal_Service__c ";
$response = $mySforceConnection->countQuery($query);
print_r ($response);
Thanks
David Hales (1058)