-1

我有一个奇怪的问题。

一旦连接到数据库,我只能返回一列值(FG-PCT 列)。

这是我的查询:

$query = "SELECT sstorm_players.player_LastName  AS 'Full Name',          
sum(sstorm_rawstats1.stats1_GP) AS 'GP',
sstorm_players.player_PlayerID AS 'PlayerID',
sstorm_players.player_Current AS 'Current',
sstorm_players.player_YEAR2011_12 AS '2011-12',
Sum(sstorm_rawstats1.stats1_FGM) AS 'FGM', 
Sum(sstorm_rawstats1.stats1_FGA) AS 'FGA',
ROUND((sum(sstorm_rawstats1.stats1_FGM) / sum(sstorm_rawstats1.stats1_FGA)*100),1 AS    'FG-PCT' 

FROM sstorm_players INNER JOIN sstorm_rawstats1 
ON sstorm_players.player_PlayerID = sstorm_rawstats1.stats1_PlayerID 
 WHERE sstorm_players.player_PlayerID = sstorm_rawstats1.stats1_PlayerID
GROUP BY sstorm_players.player_PlayerID
HAVING sstorm_players.player_YEAR2011_12 = true 
order by ROUND((sum(sstorm_rawstats1.stats1_FGM) / sum(sstorm_rawstats1.stats1_FGA)*100),1) desc";

当我回显所选值时,我只能返回其中一列(FC-PCT 列)。

这是我的回声语句的示例:

// this statement has values that do not get returned
echo "<td align='center' bgcolor='$row_color'><strong>" . $row['FGM)'] . "</strong></td>";

// this statement has values that do not get returned
echo "<td align='center' bgcolor='$row_color'><strong>" . $row['FGA)'] . "</strong></td>";

// this statement has values that get returned
echo "<td align='center' bgcolor='$row_color'><strong>" . $row['FG-PCT'] . "</strong></td>";

我没有回显查询中的所有列。

任何帮助将非常感激。

谢谢,

4

1 回答 1

1

您的数组键中有一个正确的括号,这就是它无法访问这些值的原因:

$row['FGM)']应该是$row['FGM']

$row['FGA)']应该$row['FGA']

于 2012-10-27T01:49:50.567 回答