我想显示所有Leads Group by City,我使用php将SalesForce集成到我的应用程序中,并且我有查询结果。
对于简单查询,不难显示结果,但查询类似
“选择计数('名字'),城市由Lead Group By City”
我不知道如何显示数组。
这是代码。
$response = $mySforceConnection->query($query);
foreach ($response->records as $record)
{
$object = get_object_vars($record);
print_r($object);
echo "<br />";
}
结果是这样的:
Array ( [Id] => [any] => Array ( [expr0] => 4 [0] => ) )
Array ( [Id] => [any] => Array ( [expr0] => 1 [0] => Atlanta, GA ) )
Array ( [Id] => [any] => Array ( [expr0] => 8 [0] => Austin, TX ) )
Array ( [Id] => [any] => Array ( [expr0] => 3 [0] => Baltimore, MD ) )
Array ( [Id] => [any] => Array ( [expr0] => 3 [0] => Boston, MA ) )
Array ( [Id] => [any] => Array ( [expr0] => 10 [0] => Central Jersey, NJ ) )
Array ( [Id] => [any] => Array ( [expr0] => 17 [0] => Central VA ) )
Array ( [Id] => [any] => Array ( [expr0] => 1 [0] => Chicago East, IL ) )
Array ( [Id] => [any] => Array ( [expr0] => 11 [0] => Chicago West, IL ) )
Array ( [Id] => [any] => Array ( [expr0] => 2 [0] => Cleveland, OH ) )
Array ( [Id] => [any] => Array ( [expr0] => 5 [0] => Dallas, TX ) )
Array ( [Id] => [any] => Array ( [expr0] => 3 [0] => Detroit, MI ) )
Array ( [Id] => [any] => Array ( [expr0] => 2 [0] => Fitchburgh, MA ) )
Array ( [Id] => [any] => Array ( [expr0] => 1 [0] => Fort Worth, TX ) )
Array ( [Id] => [any] => Array ( [expr0] => 10 [0] => Hartford, CT ) )
Array ( [Id] => [any] => Array ( [expr0] => 1 [0] => Houstan Cypress ) )
Array ( [Id] => [any] => Array ( [expr0] => 6 [0] => Houston North, TX ) )
Array ( [Id] => [any] => Array ( [expr0] => 2 [0] => Houston South, TX ) )
Array ( [Id] => [any] => Array ( [expr0] => 2 [0] => Indiana, IN ) )
Array ( [Id] => [any] => Array ( [expr0] => 14 [0] => LA East, CA ) )
答案 0 :(得分:0)
正如您所见here,您可以通过以下方式指导以显示计数:
foreach($object[expr0] as $child) {
echo $child . "\n";
}
要打印城市,您必须将$object[expr0]
替换为$object[0]