【发布时间】:2016-09-28 07:32:37
【问题描述】:
当我尝试从 Google BigQuery 中的表中提取的数据中将行读取到数组中时,它只会将第一行读取到数组中。
我在其他代码中也是这样做的,不知道为什么没有读取所有行。
<?php
function top10($chart){
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->addScope(Google_Service_Bigquery::BIGQUERY);
$bigquery = new Google_Service_Bigquery($client);
$projectId = 'projectID';
$request = new Google_Service_Bigquery_QueryRequest();
$query = "SELECT First_Name, Last_Name, G FROM [" . $chart. "] ORDER BY G DESC LIMIT 10";
$request->setQuery($query);
$response = $bigquery->jobs->query($projectId, $request);
$rows = $response->getRows();
$ii = 0;
$i = 0;
foreach ($rows as $row)
{
foreach ($row['f'] as $field)
{
$Info[$i][$ii] = $field['v'];
$ii++;
}
$i++;
}
}
?>
【问题讨论】:
标签: php google-app-engine multidimensional-array google-bigquery